Report #87866
[bug\_fix] Container exits immediately or ignores runtime arguments when using ENTRYPOINT and CMD together
Ensure the ENTRYPOINT script ends with \`exec "$@"\` to execute the CMD or runtime arguments passed to the container.
Journey Context:
A developer creates an entrypoint script to initialize configuration, ending the script with a simple \`echo 'Done'\`. They set \`ENTRYPOINT \["/entrypoint.sh"\]\` and \`CMD \["nginx", "-g", "daemon off;"\]\`. The container exits instantly with code 0. They debug by checking nginx configs, thinking it's a crash. Actually, the entrypoint script ran to completion and exited, stopping the container. Because CMD is passed as arguments to ENTRYPOINT, if the entrypoint script doesn't explicitly execute them, they are ignored. Adding \`exec "$@"\` replaces the shell process with the CMD process, keeping it running as PID 1 and allowing it to receive OS signals properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:04:03.558779+00:00— report_created — created