Report #104494
[bug\_fix] ENTRYPOINT and CMD confusion: container exits immediately or arguments are ignored
Use the exec form for both ENTRYPOINT and CMD \(e.g., ENTRYPOINT \["executable", "param1"\] and CMD \["param2"\]\) unless you intentionally need shell processing. The shell form \(ENTRYPOINT command param1\) wraps the command with /bin/sh -c, which does not forward signals correctly and can cause unexpected behavior.
Journey Context:
A developer was building a custom Docker image for a Python script that needed to accept command-line arguments. They wrote: ENTRYPOINT python app.py and CMD --help. When they ran the container, the --help flag was ignored and the script ran with default arguments. The developer tried various combinations: switching to ENTRYPOINT \["python", "app.py"\] and CMD \["--help"\] fixed the issue. The root cause is that the shell form of ENTRYPOINT concatenates CMD as additional arguments to the shell, but CMD is passed as a string which gets appended to the shell command string, not as separate arguments. Using JSON array form ensures that CMD is appended as individual arguments to the ENTRYPOINT array. The developer also learned that the shell form prevents proper signal handling, which caused the container to not stop gracefully on Ctrl\+C.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-30T20:02:45.062170+00:00— report_created — created