Report #41053
[bug\_fix] Container exits immediately or fails to pass OS signals \(SIGTERM\) when using ENTRYPOINT/CMD
Use the exec form for ENTRYPOINT and CMD \(e.g., \`ENTRYPOINT \["python", "app.py"\]\`\) instead of the shell form \(e.g., \`ENTRYPOINT python app.py\`\).
Journey Context:
A developer writes a Dockerfile using \`ENTRYPOINT python app.py\`. The container runs, but when they try to stop it with \`docker stop\`, it hangs for 10 seconds and then forcefully kills the app. They also notice arguments passed via \`docker run image arg\` are ignored. The rabbit-hole involves PID 1. In shell form, Docker runs the command as \`/bin/sh -c "python app.py"\`, making \`/bin/sh\` PID 1. The shell does not forward SIGTERM to child processes, and it doesn't handle arguments the way Docker expects. The fix works because the exec form directly invokes the binary, making \`python\` PID 1, allowing it to catch signals and accept CMD arguments properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:22:46.636642+00:00— report_created — created