Shell Form vs Exec Form
CMD python app.py (shell form) runs the app, but docker stop always waits 10 seconds and kills it. What is the reason?
CMD python app.py
docker stop
Choose one answer
docker stop always waits for the full grace period before it sends any signal at all.
Python ignores SIGTERM unless the image is based on Debian.
SIGTERM
Shell form commands run as a different user, who can't receive signals.
PID 1 is /bin/sh -c, which doesn't forward SIGTERM to Python.
/bin/sh -c