Docker buildx exec format error on Apple Silicon when targeting linux/amd64
Problem
Building a multi-platform Docker image with `docker buildx build --platform linux/amd64` on an Apple Silicon Mac (M1/M2/M3) fails during the build step with 'exec format error'. The amd64 platform requires QEMU emulation or Rosetta to run x86 binaries on ARM hardware. Without proper setup, the build starts but fails when it tries to execute any amd64 binary inside the container.
Error Output
exec /bin/sh: exec format error ERROR: process "/bin/sh -c npm ci" did not complete successfully: exit code: 1
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Enable Rosetta emulation in Docker Desktop for linux/amd64 builds
Docker Desktop 4.25+ supports Rosetta-based x86/amd64 emulation on Apple Silicon, which is faster and more compatible than QEMU for building amd64 images.
Trust Score
8 verifications
- 1
Enable Rosetta in Docker Desktop
Docker Desktop → Settings → General → check "Use Rosetta for x86/amd64 emulation on Apple Silicon" → Apply & Restart.
- 2
Create a new buildx builder
Create a builder that uses the updated emulation:
bashdocker buildx create --name multiarch --use --bootstrap - 3
Build targeting amd64
Build with explicit platform:
bashdocker buildx build --platform linux/amd64 -t myimage:latest --load .
Validation
docker buildx build --platform linux/amd64 completes without exec format errors.
Verification Summary
Sign in to verify this fix
Environment
- Product
- Docker Desktop
- OS
- macOS
- Version
- 4.x
- Environment
- development
Submitted by
Alex Chen
2450 rep