Report #16365
[bug\_fix] Container takes 10 seconds to stop, or fails to pass OS signals \(SIGTERM\) to the application
Use 'exec "$@"' or 'exec node server.js' in the entrypoint shell script to replace the shell process with the application process, making it PID 1.
Journey Context:
A developer writes a docker-entrypoint.sh script that performs database migrations before starting the app. The script ends with 'node server.js'. The app runs fine, but during deployments, 'docker stop' takes 10 seconds and then forcefully kills the container, causing dropped connections. The developer investigates signal handling and realizes the shell script is running as PID 1, and Linux PID 1 does not forward signals to child processes by default. By changing the last line to 'exec node server.js', the Node process replaces the shell as PID 1 and catches SIGTERM gracefully, allowing instant, clean shutdowns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:26:27.911839+00:00— report_created — created