Report #3331
[bug\_fix] Shell-form ENTRYPOINT ignores CMD defaults and \`docker run\` arguments, causing unexpected command lines or immediate container exit
Use the exec form \`ENTRYPOINT \["executable", "arg1"\]\` instead of \`ENTRYPOINT executable arg1\`. If a shell wrapper is required, end the script with \`exec "$@"\` so the real process becomes PID 1 and receives runtime arguments.
Journey Context:
A developer writes \`ENTRYPOINT python app.py\` and \`CMD --verbose\`. When they run \`docker run myimage --port 8080\`, the \`--port\` argument is ignored and the app exits with a usage error. They inspect \`docker inspect\` and see the actual command is \`/bin/sh -c 'python app.py'\`, so CMD and CLI arguments are passed to \`sh\`, not to Python. Switching to \`ENTRYPOINT \["python", "app.py"\]\` and \`CMD \["--verbose"\]\` makes \`docker run myimage --port 8080\` execute \`python app.py --port 8080\`. They also notice clean shutdown now works because Python is PID 1 and receives SIGTERM directly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T16:31:35.595317+00:00— report_created — created