Skip to content

Fix ARM64 Docker builds with QEMU emulation and buildx #151

Description

@wkoszek

ARM64 Docker builds are failing because we're building on AMD64 hosts without proper cross-platform build support.

Error

The requested image's platform (linux/arm64/v8) does not match 
the detected host platform (linux/amd64/v3)
exec /bin/sh: exec format error

Root Cause

We removed use: buildx in #149 to fix the --load flag error, but buildx is actually required for cross-platform builds. Without buildx, Docker cannot build ARM64 images on AMD64 hosts.

The real issue in #149 was the --load flag, not buildx itself.

Solution

  1. Re-add use: buildx
  2. Set up QEMU emulation in CI workflow for cross-platform builds
  3. Set up buildx properly before GoReleaser runs
  4. Ensure buildx doesn't try to use --load (it shouldn't for multi-platform)

Implementation

Step 1: Set up QEMU and buildx in workflow

- name: Set up QEMU
  uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v3

Step 2: Re-add buildx to .goreleaser.yaml

dockers:
  - use: buildx
    goarch: arm64

How It Works

  • QEMU provides ARM64 emulation on AMD64 hosts
  • Buildx uses QEMU to build ARM64 images
  • GoReleaser pushes images directly (no --load)
  • docker_manifests combines architectures

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions