exec /docker-entrypoint.sh: no such file or directory (CRLF line endings / missing interpreter)
The entrypoint file exists, but the kernel can’t run it — almost always Windows CRLF line endings in the script, or a shebang pointing at a shell the image doesn’t have.
Meaning
“No such file or directory” refers to the interpreter in the first line (#!/bin/bash\r), not the script. A script saved with CRLF asks for “/bin/bash\r”, which doesn’t exist. The same error appears for binaries compiled against glibc running on Alpine (musl).
Common causes
- Script has Windows (CRLF) line endings — Git autocrlf on Windows
- Shebang uses /bin/bash but the image only has sh
- Binary built for glibc run on Alpine/musl
- Wrong architecture binary
⚡ Quick fix
- Convert to LF: dos2unix or set .gitattributes
- Use #!/bin/sh or install bash
- Build the binary for the target libc/arch (CGO_ENABLED=0 for Go)
Detailed fix by platform
Dockerfile
- bash
COPY docker-entrypoint.sh /usr/local/bin/ RUN sed -i 's/\r$//' /usr/local/bin/docker-entrypoint.sh && chmod +x /usr/local/bin/docker-entrypoint.sh
Git
- bash
# .gitattributes *.sh text eol=lf
How to diagnose
- Line endings — file docker-entrypoint.sh (look for CRLF)
- Shebang — head -1 of the script
- Binary — file ./app — static or dynamic, which arch?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- ACR unauthorized Azure Container Registry: unauthorized: authentication required, visit https://aka.ms/acr/authorization (AKS ErrImagePull 401)
- Conflict container name Conflict. The container name "/x" is already in use by container …
- Container failed to start Cloud Run: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable
Most viewed in Docker
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Report a correction or suggest an improvement
Last updated 7 Oct 2026