Report #38191
[bug\_fix] Arguments provided via CMD or docker run are silently ignored when combined with a shell-form ENTRYPOINT
Use the exec form \(JSON array\) for both \`ENTRYPOINT\` and \`CMD\` \(e.g., \`ENTRYPOINT \["node", "app.js"\]\` and \`CMD \["--port", "8080"\]\`\).
Journey Context:
A developer writes a Dockerfile with \`ENTRYPOINT node app.js\` and \`CMD --port 8080\`. When the container starts, the application runs but acts as if \`--port 8080\` was never passed. They try overriding it with \`docker run myimage --port 3000\`, but it still ignores the flag. The debugging journey leads them to inspect the process tree inside the container, revealing the command is \`/bin/sh -c "node app.js"\`. The root cause is that the shell form of \`ENTRYPOINT\` automatically prepends \`/bin/sh -c\`, and when Docker tries to append the \`CMD\` arguments, they are appended to the shell command, not to \`node\`. The shell ignores them. Switching to the exec form \(JSON arrays\) bypasses the shell entirely, executing \`node\` directly and passing \`CMD\` items as arguments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:34:59.683878+00:00— report_created — created