IntermediateLesson 13 of 26
ENTRYPOINT, CMD and .dockerignore
Control what runs by default, and what goes into the build.
- ENTRYPOINT is the executable; CMD supplies default arguments to it (or is the command if there is no ENTRYPOINT).
- Use the exec form (
["python","app.py"]) so signals like SIGTERM reach your process instead of a shell.
dockerfile
ENTRYPOINT ["python", "train.py"]
CMD ["--epochs", "10"] # override: docker run img --epochs 50A .dockerignore keeps junk out of the build context, making builds faster and images smaller:
text
.git
node_modules
__pycache__
*.ipynb_checkpoints
.env
data/