使用本文档:
- 我已经拉取了
vimagick/hydra
docker 镜像 在文件夹中创建
docker-compose.yml
文件~/Soft/docker/
:hydra: image: vimagick/hydra command: sleep infinity volumes: - ./data:/data working_dir: /data restart: unless-stopped
已安装
docker-compose
执行:
docker-compose up -d Starting docker_hydra_1 ... done
执行:
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