Report #3073
[bug\_fix] Container exits immediately with code 0 when running docker run, or passing arguments results in 'executable file not found in $PATH' / shell errors.
Use the exec form for ENTRYPOINT \(e.g., ENTRYPOINT \["executable", "param"\]\) and CMD for default arguments. If using an entrypoint script, ensure it uses exec "$@" to properly hand off the process and receive CMD arguments.
Journey Context:
A developer defines a Dockerfile with ENTRYPOINT \["python", "app.py"\] and CMD \["--help"\]. They try to override the argument with docker run myimage --version, but it fails. In another attempt, they use the shell form ENTRYPOINT /usr/bin/app. When they run docker run myimage --flag, the flag is completely ignored. They fall down a rabbit hole of shell quoting and environment variables. They eventually realize the shell form of ENTRYPOINT invokes /bin/sh -c, which does not pass arguments through to the underlying process. The fix is to switch to the exec form ENTRYPOINT \["/usr/bin/app"\] and use CMD \["--default-flag"\]. This works because the exec form directly invokes the binary via the OS, allowing CMD or docker run arguments to be properly passed as parameters, and ensuring the application receives OS signals \(like SIGTERM\) correctly without a shell PID 1 blocking them.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T15:20:02.197399+00:00— report_created — created