As you know, in a Dockerfile, you can specify commands through the RUN and CMD parameters (example bellow).
...
RUN pip3 install --upgrade pip
RUN pip3 install pytest
...
CMD ["python3", "main.py"]
...
In the docker-compose.yml
, you can also specify the command parameter (example bellow).
...
services:
conteiner_a:
...
command: ["echo", "!!!!!!!! Container_A is available now !!!!!!!!"]
...
What is the difference?
CodePudding user response:
command
parameter in docker-compose
file is overriding the default CMD
from the DockerFile
.