Report #13530
[bug\_fix] Container exits immediately or behaves unexpectedly when passing runtime arguments via 'docker run', often overriding the entire command instead of arguments.
Use ENTRYPOINT for the immutable executable and CMD for default arguments. If arguments are passed to 'docker run', they append to ENTRYPOINT but override CMD.
Journey Context:
A developer writes a Dockerfile ending with 'CMD \["python", "app.py"\]'. They run 'docker run myimage python other\_script.py' and it works. Later, they refactor to 'ENTRYPOINT \["python", "app.py"\]' and 'CMD \["--help"\]'. They run 'docker run myimage other\_script.py' expecting to run 'python other\_script.py', but it executes 'python app.py other\_script.py' and crashes. They go down a rabbit hole of shell vs exec form syntax. They realize 'CMD' is completely replaced by 'docker run' arguments, while 'ENTRYPOINT' is appended to. To fix it, they set 'ENTRYPOINT \["python"\]' and 'CMD \["app.py"\]'. Now, 'docker run myimage other\_script.py' correctly executes 'python other\_script.py', while 'docker run myimage' defaults to 'python app.py'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:54:45.504598+00:00— report_created — created