Building Multi-Platform Docker Images with Buildx (amd64 and arm64)
Build container images for both x86 and ARM with docker buildx: builders, QEMU emulation vs native nodes, manifest lists, cross-compilation and CI setup.
Published December 2, 2026
Developers increasingly work on ARM laptops while servers run on x86, and cloud ARM instances offer attractive price-performance. An image built only for one architecture fails with "exec format error" on the other. Docker Buildx builds a single image tag that contains variants for multiple platforms, and the runtime pulls the right one automatically.
The concept
A multi-platform image is a manifest list (or OCI image index) pointing to one image per platform, such as linux/amd64 and linux/arm64. When a node pulls the tag, the registry returns the variant matching its architecture.
Buildx can produce each variant in three ways: emulation with QEMU (simple but slow for compile-heavy builds), native builder nodes for each architecture (fast, more setup), or cross-compilation in the Dockerfile where the toolchain supports it (Go, Rust, many JavaScript builds), using the BUILDPLATFORM and TARGETPLATFORM build arguments.
What a multi-platform image is
Build strategies
| Method | Speed | Setup | Best for |
|---|---|---|---|
| QEMU emulation | Slow (often several times slower) | Easy | Small images, interpreted languages |
| Native builder nodes | Fast | Needs ARM + x86 builders | Large compiled projects |
| Cross-compilation | Fast | Dockerfile changes | Go, Rust, static binaries |
Emulation cost
Practical examples
Create a builder and build both platforms
Push is required because the local image store holds one platform by default.
docker buildx create --name multi --use
docker buildx build --platform linux/amd64,linux/arm64 \
-t registry.example.com/api:2.3.1 --push .
docker buildx imagetools inspect registry.example.com/api:2.3.1Cross-compile a Go binary
Build on the native platform, target the requested one.
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:1.23 AS build
ARG TARGETOS TARGETARCH
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/app ./cmd/app
FROM gcr.io/distroless/static-debian12
COPY --from=build /out/app /app
ENTRYPOINT ["/app"]GitHub Actions setup
QEMU and Buildx actions handle emulation and builders.
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: registry.example.com/api:${{ github.sha }}Common mistakes
- Building on an ARM Mac and deploying the arm64-only image to x86 servers.
- Compiling large native dependencies under QEMU and accepting very slow builds.
- Base images that do not publish the platform you target.
- Expecting --load to store a multi-platform image locally (use --push or an OCI exporter).
Key takeaways
- A multi-platform tag is a manifest list of per-architecture images.
- Buildx builds variants via emulation, native nodes or cross-compilation.
- Use BUILDPLATFORM/TARGETPLATFORM for fast cross builds.
- Inspect manifests to verify the platforms you ship.
FAQ
What is "exec format error"?
The binary in the image was built for a different CPU architecture than the host running it.
Can I build only arm64 locally?
Yes: --platform linux/arm64 with --load works for a single platform.
Do I need multi-arch for Kubernetes?
Only if your clusters contain nodes of different architectures, or you want flexibility to move to ARM instances.