Report #10718
[bug\_fix] CMD arguments are ignored or overridden when using ENTRYPOINT
Use the exec form for both ENTRYPOINT and CMD \(e.g., ENTRYPOINT \["python", "app.py"\] and CMD \["--help"\]\). Do not use the shell form \(ENTRYPOINT python app.py\) if you expect CMD or docker run arguments to be passed to the entrypoint, as the shell form discards CMD.
Journey Context:
A developer writes a Dockerfile using ENTRYPOINT python app.py and defines CMD \["--port", "8080"\] to provide default arguments. When they run the container, the port argument is completely ignored. They try overriding it via docker run myimage --port 9090, but it still fails. They debug by printing sys.argv and realize the arguments are never reaching the Python script. Consulting the Docker documentation, they discover that the shell form of ENTRYPOINT implicitly runs /bin/sh -c, which does not pass CMD or CLI arguments to the underlying process. Switching to the exec form array syntax \(ENTRYPOINT \["python", "app.py"\]\) fixes it, as exec form explicitly allows CMD to act as default parameters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:24:12.594123+00:00— report_created — created