Report #86514
[bug\_fix] Container exits immediately with code 0 when passing runtime arguments, or arguments are ignored
If using an entrypoint script, ensure it ends with \`exec "$@"\` to pass execution to the \`CMD\` or runtime arguments. If the command should be easily overridden, use \`CMD\` instead of \`ENTRYPOINT\`.
Journey Context:
A developer writes an \`entrypoint.sh\` script to perform runtime setup \(like waiting for a database or generating dynamic configs\). They end the script with \`exec python app.py\` and define it as \`ENTRYPOINT \["/entrypoint.sh"\]\` with \`CMD \["--help"\]\`. When they run \`docker run myimage --version\`, the container ignores \`--version\` and just runs the python app. They debug by adding \`echo $@\` and realize the runtime arguments are being passed as positional parameters to the script, but the script is hardcoding the final \`exec\` call, dropping the arguments. The fix is to replace the hardcoded command with \`exec "$@"\`, which executes the parameters passed to the script \(which Docker populates with the \`CMD\` or runtime arguments\), properly chaining the entrypoint and command.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T03:48:17.613997+00:00— report_created — created