Report #80452
[bug\_fix] exec user process caused: exec format error when running a container with a custom entrypoint script, despite correct architecture.
Convert the line endings of the shell script \(e.g., \`entrypoint.sh\`\) from CRLF \(Windows\) to LF \(Unix\) before copying it into the image, or configure Git to handle line endings correctly.
Journey Context:
A developer builds a Docker image on a Windows machine. The Dockerfile copies an \`entrypoint.sh\` script and sets it as the \`ENTRYPOINT\`. Upon running, it crashes with 'exec format error'. They assume they built for the wrong architecture \(e.g., ARM vs AMD\) and add \`--platform=linux/amd64\`, but it still fails. They check the shebang \`\#\!/bin/bash\` and it looks correct. The hidden culprit: Git on Windows checked out the script with CRLF line endings. When copied into the Linux container, the bash interpreter sees \`\#\!/bin/bash\\r\` and fails to find \`/bin/bash\\r\`, resulting in the format error. Fixing the Git config \(\`core.autocrlf=input\`\) or converting the file to LF fixes it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:38:47.679165+00:00— report_created — created