Menu

1 / 2

"exec format error": images built on an Apple Silicon Mac, running on an x86 server

DEV Community: docker·anders lee·9 days ago
#arWPONBU
#devtodocker#devto#dev#build#linux
Reading 0:00
15s threshold

The image runs fine on your Mac. You push it, pull it on a cloud server, and the container exits immediately:

exec /app: exec format error

Enter fullscreen mode

Exit fullscreen mode

The image isn't corrupted. It was built for the wrong CPU. Apple Silicon Macs build linux/arm64 images by default, while most cloud servers are linux/amd64 (x86_64), and machine code for one can't run on the other. Everything below was tested on an amd64 Linux host with Docker Engine 29.9 and Buildx 0.38, without QEMU installed.

Reproducing it

Force the arm64 variant of an image on an amd64 host:

$ docker run --rm --platform linux/arm64 alpine:3.23 uname -m Unable to find image 'alpine:3.23' locally 3.23: Pulling from library/alpine Digest: sha256:85fe1e81d6758c208f3e1eed4338a1997e19d4be002d4dd32d3100c9a8c010a0 Status: Image is up to date for alpine:3.23 exec /bin/uname: exec format error

Enter fullscreen mode

Exit fullscreen mode

Docker happily downloads the arm64 version; the host CPU just can't execute it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.