Report #90000
[bug\_fix] Container exits immediately with code 0 when attempting to pass runtime arguments via \`CMD\` or \`docker run\`, or the process doesn't receive shutdown signals.
Change \`ENTRYPOINT\` and \`CMD\` to use the exec form \(JSON array syntax, e.g., \`ENTRYPOINT \["python"\]\`, \`CMD \["app.py"\]\`\) instead of the shell form \(\`ENTRYPOINT python\`\).
Journey Context:
A developer writes a Dockerfile with \`ENTRYPOINT python app.py\` and later tries to override the app name using \`docker run myimage app2.py\`, but the container just runs \`app.py\` and ignores the argument. They try changing \`CMD\` in the Dockerfile, but it's still ignored. They then notice that when they run \`docker stop\`, the container takes 10 seconds to exit \(SIGKILL timeout\), indicating it's not handling SIGTERM. The root cause is that the shell form of \`ENTRYPOINT\` executes the command as a child of \`/bin/sh -c\`, making \`/bin/sh\` PID 1. \`/bin/sh\` does not pass arguments from \`CMD\` to the child process, and it refuses to forward signals like SIGTERM to its children. Switching to the exec form \(\`ENTRYPOINT \["python", "app.py"\]\` or \`ENTRYPOINT \["python"\]\` with \`CMD \["app.py"\]\`\) makes the specified executable 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-22T09:39:32.491801+00:00— report_created — created