Docker

無法進入 docker 容器的 bash:hydra 容器正在重新啟動

  • January 24, 2020

使用本文件

  1. 我已經提取了vimagick/hydradocker 鏡像
  2. docker-compose.yml在文件夾中創建文件~/Soft/docker/
hydra:
 image: vimagick/hydra
 command: sleep infinity
 volumes:
   - ./data:/data
 working_dir: /data
 restart: unless-stopped
  1. 已安裝docker-compose
  2. 執行:docker-compose up -d Starting docker_hydra_1 ... done
  3. 執行:docker-compose exec hydra bash Error response from daemon: Container ecf710f3f9526cf598c4a15a485fbfc3790a36e5f8b989820a157ba5453fc24f is restarting, wait until the container is running

docker ps給出:

CONTAINER ID        IMAGE                  COMMAND                 CREATED             STATUS                            PORTS                NAMES
ecf710f3f952        vimagick/hydra         "bash sleep infinity"   20 hours ago        Restarting (126) 20 seconds ago                        docker_hydra_1
93b5c43c6952        vulnerables/web-dvwa   "/main.sh"              39 hours ago        Up 23 minutes                     0.0.0.0:80->80/tcp   dvwatest


$ docker exec -it ecf bash
Error response from daemon: Container ecf710f3f9526cf598c4a15a485fbfc3790a36e5f8b989820a157ba5453fc24f is restarting, wait until the container is running

我看到該docker-compose.yml文件包含restart: unless-stopped記錄。但是為什麼會這樣記錄以及當我無法連接到它時如何使用這個容器?

謝謝!

編輯您docker-compose.yml的如下:

hydra:
 image: vimagick/hydra
 entrypoint: sleep
 command: infinity
 volumes:
   - ./data:/data
 working_dir: /data
 restart: unless-stopped

引用自:https://unix.stackexchange.com/questions/563837