Report #61480
[bug\_fix] Container exits immediately with code 0, or /bin/sh: : not found when passing arguments to ENTRYPOINT
Append \`exec "$@"\` to the end of the ENTRYPOINT script. This ensures that the shell script executes the command passed via CMD or \`docker run\` arguments, properly handing off PID 1 to the application.
Journey Context:
A developer writes an entrypoint script \(\`entrypoint.sh\`\) to perform runtime configuration \(like setting dynamic environment variables or waiting for a database\) before starting the main application. They set \`ENTRYPOINT \["/entrypoint.sh"\]\` and \`CMD \["node", "server.js"\]\`. The container starts, the script runs, but the Node.js server never starts, and the container exits with code 0. The developer spends hours checking if Node is installed correctly and if the server.js file exists. They finally realize that the shell script executed successfully, but because it didn't explicitly execute the arguments passed to it \(the CMD\), it simply exited, causing the container to stop. Adding \`exec "$@"\` bridges the gap between the ENTRYPOINT script and the CMD.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:40:49.339774+00:00— report_created — created