Report #40282
[bug\_fix] Running 'docker run myimage arg' passes 'arg' to the ENTRYPOINT but silently drops the original CMD arguments, breaking the container's default runtime behavior.
Understand that 'docker run' arguments replace CMD entirely; they do not append to it. If using ENTRYPOINT, redefine the default arguments in CMD, and explicitly pass all required arguments when overriding via 'docker run'.
Journey Context:
A developer has a Dockerfile with 'ENTRYPOINT \["python", "app.py"\]' and 'CMD \["--port", "8080"\]'. The container starts fine, listening on 8080. They want to add a debug flag, so they run 'docker run myimage --debug'. The container crashes immediately with a missing port error. They go down a rabbit hole thinking '--debug' is being appended to the CMD arguments. They spend hours debugging the Python argument parser. They finally inspect the container's process list \(docker top\) and see the running command is 'python app.py --debug'. The '--port 8080' from CMD is completely gone. They realize that ENTRYPOINT and CMD are concatenated into a single command only if CMD is left untouched. Any arguments passed via 'docker run' replace the CMD instruction entirely. To fix it, they must run 'docker run myimage --port 8080 --debug', or redesign the entrypoint script to handle default arguments internally.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:05:04.491082+00:00— report_created — created