exec /usr/local/bin/docker-entrypoint.sh: exec format error
The container tried to run a binary built for a different CPU architecture (arm64 vs amd64) — or a script with a broken shebang / Windows line endings.
exec format errorThe requested image's platform (linux/arm64) does not match the detected host platform Meaning
Images built on Apple Silicon (arm64) and run on x86_64 servers (or the reverse) fail instantly with this error, often showing up as CrashLoopBackOff in Kubernetes. The other common source is an entrypoint script saved with CRLF line endings or without a #!/bin/sh line.
Common causes
- Image built for arm64 (M1/M2/M3 Mac) running on amd64 servers, or vice versa
- Base image tag only published for one architecture
- Entrypoint script with Windows CRLF line endings
- Missing shebang (
#!/bin/sh) at the top of the script
⚡ Quick fix
- Check architectures:
docker image inspect <img> --format '{{.Architecture}}'vsuname -mon the host - Build for the target platform:
docker buildx build --platform linux/amd64 - Convert scripts to LF (
dos2unix entrypoint.sh) and add a shebang
Detailed fix by platform
Docker
- Build multi-arch images:bash
docker buildx create --use docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/acme/api:1.4 --push . - Normalise line endings in the image build:dockerfile
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
How to diagnose
- Architecture — Image arch vs host arch?
- Script — Shebang present? CRLF line endings?
- Base image — Is the tag published for your platform?
🔧 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
Most viewed in Docker
- docker-credential-desktop error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH
- did not complete successfully failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: 1
- lookup registry-1.docker.io: no such host dial tcp: lookup registry-1.docker.io: no such host / Temporary failure in name resolution during docker build
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026