Report #87165
[bug\_fix] /bin/sh: ./entrypoint.sh: not found or exec user process caused: exec format error
Convert the entrypoint script's line endings from CRLF to LF \(Unix format\) before or during the Docker build, for example by adding \`RUN sed -i 's/\\r$//' entrypoint.sh\` in the Dockerfile.
Journey Context:
A developer writes a custom entrypoint script locally on a Windows machine and sets it as \`ENTRYPOINT \["./entrypoint.sh"\]\`. The build succeeds, but the container instantly crashes with a confusing 'not found' or 'exec format error', even though the file is clearly copied and has execute permissions. They fall down a rabbit hole checking the base image's shell path \(\`/bin/bash\` vs \`/bin/sh\`\), checking file permissions \(\`chmod \+x\`\), and even rebuilding the base image. They might even try an absolute path. Eventually, they inspect the file inside the container and discover Windows-style CRLF line endings. The Linux kernel tries to parse the shebang \`\#\!/bin/sh\\r\` and looks for \`/bin/sh\\r\`, which doesn't exist. The \`sed\` command strips the carriage return, allowing the kernel to parse the shebang correctly and execute the script.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:53:49.427709+00:00— report_created — created