Answer the question
In order to leave comments, you need to log in
What is the difference between deploy description in docker-compose command and ENTRYPOINT?
docker-compose.yml:
...
web:
restart: always
build: .
image: web
command: bash -c "
python manage.py collectstatic --no-input &&
python manage.py migrate &&
gunicorn config.wsgi -b 0.0.0.0"
volumes:
- ~/myjob_files/static:/static
- ~/myjob_files/uploads:/uploads
- ~/myjob_files/nginx:/nginx
expose:
- "8000"
links:
- db
...
deploy:
stage: deploy
script:
- docker-compose down
- docker-compose up -d
only:
- master
Answer the question
In order to leave comments, you need to log in
ENTRYPOINT
defines a command that will be executed when the container is started. CMD
defines the arguments to be passed to ENTRYPOINT
.
Docker defaults ENTRYPOINT
to /bin/sh -c
In turn, command
the parameter in docker-compose.yml
overrides CMD
from the dockerfile.
That's all the differences.
Regarding conciseness, what is related to the container itself and what does not depend on the environment in which the container is launched is more logical to remove in Dockerfile/entrypoint.sh in order to avoid duplication in case of several docker-compose.yml
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question