[英]docker-compose - unable to attach to containers
Using below docker-compose.yml
file if I run " docker-compose up
" or " docker-compose up -d
" command then I see both containers status as exited however when I run docker restart <postgres-containerId>
then its up and running but when I try to run docker restart <java8-containerId>
then its restarting and again exiting. 使用下面docker-compose.yml
文件,如果我运行“ docker-compose.yml
docker-compose up
”或“ docker-compose up -d
”命令,那么我看到两个容器状态都已退出但是当我运行docker restart <postgres-containerId>
然后它的up和运行但当我尝试运行docker restart <java8-containerId>
然后重新启动并再次退出。
Could you please suggest what parameter I need to specify to make these containers up and running
after docker-compose up
command and how do I attach to java container
I tried with docker attach <java8-containerId>
command but was not able to attach ? 你能否建议在docker-compose up
命令之后我需要指定哪些参数来使这些containers up and running
how do I attach to java container
我尝试使用docker attach <java8-containerId>
命令但是无法附加?
docker-compose.yml file -
postgres:
image: postgres:9.4
ports:
- "5430:5432"
javaapp:
image:java8:latest
volumes:
- /pgm:/pgm
working_dir: /pgm
links:
- postgres
command: /bin/bash
docker-compose ps results -
Name Command State Ports
--------------------------------------------------------------------
compose_javaapp_1 /bin/bash Exit 0
compose_postgres_1 /docker-entrypoint.sh postgres Exit 0
To see available containers: 要查看可用容器:
docker ps -a
To open container shell: 要打开容器shell:
docker exec -it <container-name> /bin/bash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.