Report #52353
[bug\_fix] Container exits immediately or fails with 'executable file not found' when passing runtime arguments, despite ENTRYPOINT and CMD being defined.
Use the exec form for ENTRYPOINT \(e.g., ENTRYPOINT \["/my-app"\]\) and the exec form for CMD \(e.g., CMD \["--help"\]\). If shell form is used for ENTRYPOINT \(ENTRYPOINT /my-app\), CMD and docker run arguments will be completely ignored because the shell form invokes /bin/sh -c which does not pass down command line arguments.
Journey Context:
A developer configures a Dockerfile with ENTRYPOINT /usr/bin/python app.py to run a script, and adds CMD \["--debug"\] to provide default arguments. When they run the container, it starts but ignores the --debug flag. They try overriding it via docker run myimage --debug, but it is still ignored. They spend hours debugging the Python argument parser, only to realize the issue is Docker-specific. Reading the specification, they discover that shell-form ENTRYPOINT runs as a child of /bin/sh -c, which swallows any CMD or runtime arguments. They switch to the exec form ENTRYPOINT \["/usr/bin/python", "app.py"\], which directly executes the binary as PID 1, allowing Docker to properly append the CMD array or runtime arguments to the executable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:22:10.467898+00:00— report_created — created