Skip to content
Latchkey

Docker "container_linux.go: exec format error" at container start in CI

A container's entrypoint must be a binary the host CPU can execute. exec format error at start means the image (or the entrypoint binary inside it) was built for a different architecture - for example an arm64 image run on an amd64 runner, or vice versa.

What this error means

A container exits immediately with standard_init_linux.go / container_linux.go: starting container process caused: exec format error. The image arch does not match the host.

docker
standard_init_linux.go:228: exec user process caused: exec format error
# the image was built for linux/arm64 but the host is linux/amd64

Common causes

Image built for a different architecture

An arm64 image pulled or built then run on an amd64 host (or the reverse) cannot exec its entrypoint.

A misconfigured --platform

Forcing --platform to an arch the host cannot run produces an exec format error at start.

How to fix it

Build/pull for the host architecture

  1. Match the image platform to the runner architecture.
  2. For CI on amd64 runners, target linux/amd64.
Terminal
docker buildx build --platform linux/amd64 -t myorg/api:1.4.2 --load .
docker run --rm myorg/api:1.4.2

Enable emulation for cross-arch runs

  1. Install QEMU binfmt so the host can run other architectures.
Terminal
docker run --privileged --rm tonistiigi/binfmt --install all
docker run --rm --platform linux/arm64 myorg/api:1.4.2

How to prevent it

  • Match image platform to the runner architecture.
  • Use multi-arch manifests so the right variant is pulled.
  • Install QEMU binfmt when you must run cross-arch.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →