Report #57874
[bug\_fix] Container exits immediately with code 0 when runtime arguments are passed, or arguments are ignored by the ENTRYPOINT script.
Ensure the ENTRYPOINT shell script ends with \`exec "$@"\` to execute the CMD or runtime arguments passed to the container.
Journey Context:
A developer writes an entrypoint script \(\`entrypoint.sh\`\) to perform initialization tasks like waiting for a database or setting dynamic environment variables. The script runs successfully, but the primary application process \(defined in CMD\) never starts, and the container exits with code 0. They try appending \`&& node server.js\` to the script, but then \`docker run my-image node worker.js\` fails to override the command. They discover that Docker passes the CMD or runtime arguments as parameters to the ENTRYPOINT. If the entrypoint script doesn't explicitly execute these parameters, they are silently dropped. Adding \`exec "$@"\` at the end of the script works because it executes the passed arguments as a command, and \`exec\` replaces the shell process with the application process \(PID 1\), ensuring proper signal handling for graceful shutdowns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:38:00.279507+00:00— report_created — created