Report #38200
[bug\_fix] ERROR: failed to solve: process "/bin/sh -c apt-get update": exec format error when building for a different architecture \(e.g., ARM64 on an AMD64 host\)
Install QEMU user-mode emulation using \`docker run --privileged --rm tonistiigi/binfmt --install all\` and create a buildx builder supporting multiple platforms.
Journey Context:
A developer tries to build an ARM64 image for AWS Graviton from their AMD64 laptop by changing the \`FROM\` line to an \`arm64v8\` base image. The build pulls the base image successfully but immediately fails on the first \`RUN\` instruction with 'exec format error'. They are confused because the base image pulled fine. The error occurs because the host's AMD64 kernel cannot execute ARM64 binaries. The legacy builder would fail outright, but BuildKit supports multi-platform builds via QEMU emulation. The fix is to register the QEMU binary format handlers with the host kernel using the \`tonistiigi/binfmt\` image, and then create a dedicated \`buildx\` builder instance that can utilize this emulation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:35:52.447392+00:00— report_created — created