Report #94543
[bug\_fix] Container exits immediately with code 0, or CMD arguments are ignored when using a custom entrypoint script.
Add \`exec "$@"\` to the end of the \`entrypoint.sh\` script.
Journey Context:
A developer writes an \`entrypoint.sh\` script to dynamically generate a configuration file before starting the main application. The container starts, writes the config, but then exits with code 0. The main application never runs. They try running the container interactively and see the script just completes and drops back to the shell. They realize that when \`ENTRYPOINT\` is a shell script, if the script finishes executing, the container stops. The \`CMD\` instruction \(or arguments passed to \`docker run\`\) are passed as arguments to the \`ENTRYPOINT\` script. By adding \`exec "$@"\` at the end of the script, it executes the command passed as arguments \(\`$@\`\), replacing the shell process with the main application process \(via \`exec\`\) so it receives OS signals correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:16:23.432145+00:00— report_created — created