Report #97096
[bug\_fix] docker run my-image echo hello results in an error like 'exec format error' or the entrypoint script crashing/exiting immediately, instead of printing 'hello'.
Modify the ENTRYPOINT script to end with exec "$@". This ensures the entrypoint script executes the command passed as arguments \(from CMD or docker run overrides\) after completing its initialization logic.
Journey Context:
A developer writes an entrypoint script that initializes configuration files and then starts the main application using CMD. They attempt to debug the container by running 'docker run my-image bash', but the container exits instantly with an obscure error. They spend hours thinking the bash binary is missing or the base image is corrupted. They eventually realize that Docker passes 'bash' as an argument to the ENTRYPOINT script. Because the script doesn't handle arguments and simply exits after initialization, the container stops. Adding 'exec "$@"' to the end of the entrypoint script allows it to gracefully hand off execution to whatever command was passed, enabling both normal operation \(CMD\) and debugging overrides.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:33:38.718703+00:00— report_created — created