Skip to content
DevOps AI ToolKit
Newsletter
All guides
Docker with AI By James Joyner IV · · 9 min read

Docker Error Guide: 'standard_init_linux.go: exec format error' — Fix CPU Architecture Mismatch

Quick answer

Fix Docker 'standard_init_linux.go exec format error': diagnose arm64-vs-amd64 image mismatches, inspect image architecture, and build multi-arch images with buildx.

Part of the Docker Container & Runtime Errors hub
  • #docker
  • #troubleshooting
  • #errors
  • #architecture
Free toolkit

Fixing errors like this? Get 500 free DevOps AI prompts

500 copy-paste AI prompts for the stack you actually run — one PDF, free.

Overview

This error appears the instant a container tries to execute its entrypoint. The kernel loads the binary, discovers it was compiled for a different CPU architecture than the host, and refuses to run it:

standard_init_linux.go:228: exec user process caused: exec format error

The line number varies by runc version, but the tail — exec user process caused: exec format error — is constant. It almost always means the image was built for one architecture (commonly arm64/aarch64) and is being run on another (commonly amd64/x86_64), or the other way around.

Symptoms

  • A container exits immediately with a non-zero code right after docker run.
  • docker ps -a shows the container in Exited (1) seconds after creation.
  • The same image runs fine on a colleague’s laptop (Apple Silicon) but fails in CI or on an amd64 server.
  • A shell script entrypoint sometimes throws the same error when it starts with a bad shebang or has CRLF line endings.

Common Root Causes

  • Architecture mismatch — an arm64 image (built on an Apple Silicon Mac) run on an amd64 host, or vice versa. This is by far the most frequent cause.
  • Single-arch image pulled on the wrong platform — the registry served the only architecture available, which does not match the host.
  • Emulation missing — you intended to run a foreign-arch image but binfmt_misc/QEMU is not registered.
  • Corrupt or truncated binary — the entrypoint file was partially copied or is not actually an executable of the expected format.
  • Bad shebang / CRLF line endings — a shell entrypoint with #!/bin/bash\r or a missing interpreter surfaces the same exec format error.

Diagnostic Workflow

Confirm the host architecture first:

uname -m                       # x86_64 => amd64, aarch64 => arm64
docker version --format '{{.Server.Arch}}'

Inspect what architecture the image was actually built for:

docker image inspect myapp:1.4.2 --format '{{.Os}}/{{.Architecture}}'

If that prints linux/arm64 on an x86_64 host, you have found the mismatch. Check what platforms the registry offers for the tag:

docker buildx imagetools inspect registry.example.com/myapp:1.4.2

Reproduce with an explicit platform to prove the theory:

docker run --rm --platform linux/amd64 registry.example.com/myapp:1.4.2

If the entrypoint is a script rather than a compiled binary, rule out a bad shebang or line endings:

docker run --rm --entrypoint sh myapp:1.4.2 -c 'head -1 /entrypoint.sh | xxd | head -1'

A trailing 0d (carriage return) confirms CRLF line endings.

Example Root Cause Analysis

A team’s API image built cleanly on a developer’s M2 MacBook and pushed to registry.example.com/myapp:1.4.2. In production, every pod crash-looped with standard_init_linux.go:228: exec user process caused: exec format error.

Running uname -m on the production node returned x86_64. Inspecting the image showed the cause:

docker image inspect registry.example.com/myapp:1.4.2 --format '{{.Os}}/{{.Architecture}}'
# linux/arm64

The Mac had produced an arm64-only image. The fix was to publish a multi-architecture manifest so the correct variant is selected automatically per host:

docker buildx create --use
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t registry.example.com/myapp:1.4.2 \
  --push .

After the rebuild, docker buildx imagetools inspect listed both linux/amd64 and linux/arm64, and the production nodes pulled the amd64 variant and started cleanly.

Prevention Best Practices

  • Build and publish multi-arch images with docker buildx build --platform linux/amd64,linux/arm64 --push so hosts pull the matching variant automatically.
  • Pin --platform in docker run, Compose (platform:), or Kubernetes when you knowingly run a foreign architecture, and register QEMU with docker run --privileged --rm tonistiigi/binfmt --install all.
  • Add a CI check that runs docker image inspect --format '{{.Architecture}}' and fails if it does not match the target.
  • Normalize shell entrypoints to LF line endings (.gitattributes with *.sh text eol=lf) and validate your Dockerfile with the Dockerfile validator.
  • Standardize your team’s base images and build flow — see the Docker stack guide.

Quick Command Reference

uname -m                                                   # host arch
docker image inspect myapp:1.4.2 --format '{{.Os}}/{{.Architecture}}'
docker buildx imagetools inspect registry.example.com/myapp:1.4.2
docker run --rm --platform linux/amd64 myapp:1.4.2         # force platform
docker buildx build --platform linux/amd64,linux/arm64 -t myapp:1.4.2 --push .
docker run --privileged --rm tonistiigi/binfmt --install all   # enable emulation

Conclusion

exec format error is the kernel telling you a binary does not match the CPU it was handed. In containers this is nearly always an arm64/amd64 mismatch introduced when an image is built on one architecture and run on another. Inspect the image architecture, compare it to uname -m, and publish multi-arch manifests with buildx so every host gets the variant it can actually execute. When the entrypoint is a script, also rule out a broken shebang or CRLF endings before rebuilding.

Free download · 368-page PDF

Get 500 Battle-Tested DevOps AI Prompts — Free

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.