Report #12995
[bug\_fix] Container exits immediately or fails to receive OS signals \(SIGTERM\) for graceful shutdown
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 ending in ENTRYPOINT python app.py. The app runs, but when the orchestrator tries to stop the container, it waits 10 seconds and then forcefully kills it with SIGKILL. Additionally, docker run image --port 8080 fails to pass the argument to the app. The developer tries trapping signals in Python and modifying CMD, but nothing works. The root cause is that the shell form causes the command to execute as a child of /bin/sh -c, which becomes PID 1. The shell does not forward signals to child processes, and it consumes CMD arguments. Switching to the exec form directly executes the binary as PID 1, allowing it to receive signals and arguments correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:26:08.571476+00:00— report_created — created