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.
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026