Report #43754
[bug\_fix] Container exits immediately or ignores runtime arguments passed via docker run when using an 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.sh script to perform runtime setup \(like waiting for a database or generating dynamic config\). The script works perfectly, but the container exits with code 0 right after the script finishes, ignoring the CMD defined in the Dockerfile or arguments passed via docker run. They debug by running the container interactively and see the setup happen, but the main process never starts. The root cause is that when ENTRYPOINT is a shell script, Docker passes the CMD as arguments to that script. If the script doesn't explicitly read and execute those arguments, they are silently dropped. Adding exec "$@" at the end of the script replaces the shell process with the process defined by CMD, ensuring the application actually runs and receives OS signals correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T03:54:53.074892+00:00— report_created — created