无法进入 docker 容器的 bash:Hydra 容器正在重新启动

无法进入 docker 容器的 bash:Hydra 容器正在重新启动

使用本文档

  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
    
  3. 已安装docker-compose

  4. 执行:docker-compose up -d Starting docker_hydra_1 ... done

  5. 执行: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记录。但是为什么它被记录为如此以及当我无法连接到它时如何使用这个容器?

谢谢你!

答案1

编辑你的docker-compose.yml如下:

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

相关内容