docker-compose.yml文件中的command命令问题
阿神
阿神 2017-04-24 09:11:58
0
1
683

文档中说,command是覆盖容器启动后默认执行的命令。http://wiki.jikexueyuan.com/project/docker-technology-and-combat/yaml_file.html

command: bundle exec thin -p 3000

那么,容器默认执行命令在哪里查看?
能否以Docker Hub官方nginx镜像为例说一下:
https://hub.docker.com/r/library/nginx/

阿神
阿神

闭关修行中......

reply all(1)
PHPzhong

docker run nginx && docker ps --no-trunc The command column is the command that is executed by default

If there is a Dockerfile, usually the last line CMD ENTRYPOINT is it

CMD commands can be overwritten by docker run following commands, but ENTRYPOINT will not

Regardless of CMD or ENTRYPOINT, when there are multiple entries in the same Dockerfile, only the last one will be executed

e.g :
nginx:stable-alpine Dockerfile

For example, this (docker run --rm nginx:stable-alpine /bin/sh) you will find that nginx is not running
The command in docker-compose.yml is the one specified after docker run /bin/sh

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!