Report #88293
[bug\_fix] Container takes 10\+ seconds to stop on \`docker stop\`, eventually resulting in a forced SIGKILL \(exit code 137\), losing in-flight data.
Use the \`exec\` form of \`ENTRYPOINT\` or \`CMD\` \(e.g., \`CMD \["gunicorn", ...\]\`\), or ensure shell scripts use \`exec "$@"\` to replace the shell process so the application becomes PID 1 and can catch \`SIGTERM\`.
Journey Context:
A developer deploys a Node.js or Python app. When running \`docker stop\`, the container hangs for 10 seconds and then exits with code 137. The developer assumes the app is ignoring signals and adds explicit \`process.on\('SIGTERM'\)\` handlers, but it still hangs. They dive into shell scripting and Docker internals, discovering that when using the shell form \(\`CMD gunicorn app:app\`\), Docker runs \`/bin/sh -c\` as PID 1. The Linux kernel only forwards signals like \`SIGTERM\` to PID 1, and \`/bin/sh\` does not forward signals to child processes. By switching to the exec form \(\`CMD \["gunicorn", "app:app"\]\`\) or using \`exec gunicorn\` inside an entrypoint script, the application itself becomes PID 1, allowing it to gracefully shut down when Docker sends \`SIGTERM\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:47:09.750109+00:00— report_created — created