Report #98681
[bug\_fix] Container ignores SIGTERM and \`docker run --help\` is treated as a shell argument; CMD defaults are ignored
Use exec form for both ENTRYPOINT and CMD: \`ENTRYPOINT \["python", "-m", "http.server"\]\`, \`CMD \["8080"\]\`. If you need a shell wrapper, prefix the final command with \`exec\` so it replaces the shell and becomes PID 1.
Journey Context:
A developer writes \`ENTRYPOINT python -m http.server\` and \`CMD 8080\` in an image. Running \`docker run myimage 9000\` fails because the container still tries to serve on 8080. They also notice \`docker stop\` hangs for 10 seconds before SIGKILL. The root cause is that the shell form of ENTRYPOINT runs as \`/bin/sh -c 'python -m http.server'\`, making \`/bin/sh\` PID 1. Most shells do not forward SIGTERM to their children, and the shell form ignores CMD and runtime arguments. Switching to JSON exec form makes the application the direct PID 1 process, so it receives signals and runtime arguments are appended to ENTRYPOINT while CMD provides overridable defaults. Adding \`exec\` in a wrapper script achieves the same replacement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:35:37.499826+00:00— report_created — created