Skip to content

Fix: Add QEMU and buildx setup for ARM64 Docker builds (fixes #151) - #152

Merged
wkoszek merged 1 commit into
mainfrom
issue/151
Nov 25, 2025
Merged

Fix: Add QEMU and buildx setup for ARM64 Docker builds (fixes #151)#152
wkoszek merged 1 commit into
mainfrom
issue/151

Conversation

@wkoszek

@wkoszek wkoszek commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Summary

Set up QEMU emulation and Docker Buildx in CI workflow to enable cross-platform Docker builds for ARM64 architecture.

Problem

ARM64 builds were failing with "exec format error" because we're building on AMD64 hosts without proper emulation:

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

The issue occurred because:

  1. We removed use: buildx in Fix Docker buildx multi-arch build with --load flag error #149 to fix --load error
  2. Without buildx, Docker cannot cross-compile ARM64 on AMD64
  3. Need QEMU for ARM64 emulation on AMD64 hosts

Solution

  1. Add docker/setup-qemu-action to enable ARM64 emulation
  2. Add docker/setup-buildx-action to set up Docker Buildx
  3. Re-add use: buildx to goreleaser.yaml for multi-arch builds
  4. Both actions run before GoReleaser executes

How It Works

  • QEMU provides ARM64 CPU emulation on AMD64 CI runners
  • Buildx uses QEMU to build ARM64 container images
  • GoReleaser uses buildx to build both amd64 and arm64 images
  • docker_manifests combines them into multi-arch images
  • Images are pushed directly to registry (no --load flag conflict)

Changes

  • Add "Set up QEMU" step using docker/setup-qemu-action@v3
  • Add "Set up Docker Buildx" step using docker/setup-buildx-action@v3
  • Re-add use: buildx for both amd64 and arm64 builds in .goreleaser.yaml
  • Steps only run on main branch during releases

Result

  • ✅ ARM64 builds work on AMD64 CI runners
  • ✅ Multi-arch Docker images (amd64 + arm64)
  • ✅ No --load flag conflicts
  • ✅ Images pushed directly to ghcr.io

Testing

After merge, the next release will successfully build and publish multi-arch Docker images.

Fixes #151

Set up QEMU emulation and Docker Buildx in CI workflow to enable
cross-platform Docker builds for ARM64 architecture.

Problem:
ARM64 builds were failing with "exec format error" because we're
building on AMD64 hosts without proper emulation:
- "The requested image's platform (linux/arm64/v8) does not match
   the detected host platform (linux/amd64/v3)"
- "exec /bin/sh: exec format error"

Solution:
1. Add docker/setup-qemu-action to enable ARM64 emulation
2. Add docker/setup-buildx-action to set up Docker Buildx
3. Re-add "use: buildx" to goreleaser.yaml for multi-arch builds
4. Both actions run before GoReleaser executes

How it works:
- QEMU provides ARM64 CPU emulation on AMD64 hosts
- Buildx uses QEMU to build ARM64 container images
- GoReleaser uses buildx to build both amd64 and arm64 images
- docker_manifests combines them into multi-arch images
- Images are pushed directly (no --load flag conflict)

Changes:
- Add "Set up QEMU" step using docker/setup-qemu-action@v3
- Add "Set up Docker Buildx" step using docker/setup-buildx-action@v3
- Re-add "use: buildx" for both amd64 and arm64 builds
- Steps only run on main branch releases

Result:
- ARM64 builds work on AMD64 CI runners
- Multi-arch Docker images published successfully
@claude

claude Bot commented Nov 25, 2025

Copy link
Copy Markdown

Review

Concern: Running inside container with mounted Docker socket.

Workflow runs in container (line 24-29) with /var/run/docker.sock mounted. Adding QEMU/buildx actions may conflict - these actions expect host Docker daemon access, not containerized environment.

Verification needed:
Check if docker/setup-qemu-action@v3 and docker/setup-buildx-action@v3 work inside GitHub Actions containers with socket mounting. May need to run on bare runner instead.

Alternative approach:
Move QEMU/buildx setup before container job, or run release job on ubuntu-latest directly without container wrapper.

@wkoszek
wkoszek merged commit c8b2662 into main Nov 25, 2025
2 checks passed
@wkoszek
wkoszek deleted the issue/151 branch November 25, 2025 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix ARM64 Docker builds with QEMU emulation and buildx

1 participant