How do ENTRYPOINT and CMD combine?
IntermediateConceptDockerfile Instructions & Builds
Answer
In exec form, final command = ENTRYPOINT + CMD. Use ENTRYPOINT for the program and CMD for default flags:
ENTRYPOINT ["python", "app.py"]
CMD ["--port", "8000"]
# docker run img --port 9000 -> python app.py --port 9000
If ENTRYPOINT is in shell form, CMD is ignored. Only the last CMD and last ENTRYPOINT count.