exec format error Docker Origin: Platform & cloud Last updated 12 Oct 2026

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.

Exact message you may see exec format errorThe requested image's platform (linux/arm64) does not match the detected host platform
Seen on: Docker Kubernetes Linux

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

  1. Check architectures: docker image inspect <img> --format '{{.Architecture}}' vs uname -m on the host
  2. Build for the target platform: docker buildx build --platform linux/amd64
  3. Convert scripts to LF (dos2unix entrypoint.sh) and add a shebang

Detailed fix by platform

Docker

  1. 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 .
  2. 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

  1. Architecture — Image arch vs host arch?
  2. Script — Shebang present? CRLF line endings?
  3. 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:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

1011 — Cloudflare Error 1011: Access denied (Hotlinking denied) (Cloudflare)1011built for iOS, linking for simulator — Building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 (iOS)built for iOS, linkin…cannot execute binary file — cannot execute binary file: Exec format error (Linux)cannot execute binary…command not found — bash: command not found (Linux)command not foundconflict: unable to remove repository reference — conflict: unable to remove repository reference (must force) - container is using its referenced image (Docker)conflict: unable to r…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 (Google Cloud / Firebase)Container failed to s…COPY failed — COPY failed: file not found in build context / "/app/x": not found (Docker)COPY failedCrashLoopBackOff — Kubernetes: CrashLoopBackOff (Kubernetes)CrashLoopBackOffexec form…

Explore the map of this error Full error map →

🧠 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.