[英]What is the difference between the "command" parameter in the docker-compose.yml and the CMD parameter in the Dockerfile?
如您所知,在 Dockerfile 中,您可以通过 RUN 和 CMD 参数指定命令(示例如下)。
...
RUN pip3 install --upgrade pip
RUN pip3 install pytest
...
CMD ["python3", "main.py"]
...
在docker-compose.yml
中,您还可以指定命令参数(示例如下)。
...
services:
conteiner_a:
...
command: ["echo", "!!!!!!!! Container_A is available now !!!!!!!!"]
...
有什么区别?
docker-compose
文件中的command
参数覆盖来自DockerFile
CMD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.