Report #54389
[bug\_fix] Container exits immediately or ignores runtime arguments when using CMD or docker run arguments with ENTRYPOINT.
Change ENTRYPOINT from shell form \(ENTRYPOINT executable param\) to exec form \(ENTRYPOINT \["executable", "param"\]\). Shell form runs as a child of /bin/sh -c, which doesn't pass arguments to the executable, while exec form runs the executable directly, allowing CMD or docker run arguments to be passed as parameters.
Journey Context:
A developer defines ENTRYPOINT python app.py and CMD \["--help"\] expecting the container to run python app.py --help. Instead, the container runs python app.py and ignores --help. They try overriding at runtime with docker run myimage --port 8080, but the flag is ignored. They dive into process trees using docker exec and ps aux, discovering the main process is /bin/sh -c "python app.py", not python. Because /bin/sh -c doesn't forward command-line arguments to the child process, the parameters are swallowed. Switching to the exec form ENTRYPOINT \["python", "app.py"\] makes Python PID 1, which receives the CMD or runtime arguments natively as parameters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T21:47:12.622646+00:00— report_created — created