Report #74973
[bug\_fix] Docker ENTRYPOINT script ignores arguments passed via CMD or docker run
Ensure the ENTRYPOINT is specified in exec form \(e.g., \["/entrypoint.sh"\]\) and that the shell script explicitly executes passed arguments using 'exec "$@"' at the end.
Journey Context:
A developer writes an entrypoint script to perform dynamic configuration \(like replacing environment variables in a config file\) before starting the main application. They define 'ENTRYPOINT /entrypoint.sh' and 'CMD \["python", "app.py"\]'. The container starts, the script runs successfully, but the Python application never starts. The developer falls into a rabbit hole assuming CMD is being overridden or ignored. The root cause is twofold: the shell form of ENTRYPOINT implicitly passes CMD as an argument to /bin/sh -c, ignoring it, and even with exec form ENTRYPOINT, the bash script itself must explicitly execute the arguments passed to it. Adding 'exec "$@"' at the bottom of the shell script passes control to the CMD arguments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:26:14.753325+00:00— report_created — created