Skip to content

Fix: Remove buildx to fix --load flag error (fixes #149) - #150

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

Fix: Remove buildx to fix --load flag error (fixes #149)#150
wkoszek merged 1 commit into
mainfrom
issue/149

Conversation

@wkoszek

@wkoszek wkoszek commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Summary

Remove use: buildx from Docker configuration to fix the --load flag error that occurs with multi-platform builds.

Problem

When using buildx with multi-platform builds, GoReleaser tries to use the --load flag which is incompatible:

docker build failed: failed to build ghcr.io/bsubio/cli:v0.15.0-arm64: 
exit status 125: unknown flag: --load

The --load flag only works for single-platform builds that are loaded into the local Docker daemon. Multi-platform builds must be pushed directly to a registry.

Solution

Remove use: buildx and let GoReleaser build each architecture separately using standard Docker build. Each architecture is built individually, then docker_manifests combines them into multi-arch manifests.

How It Works Now

  1. Build linux/amd64 image separately with standard Docker
  2. Build linux/arm64 image separately with standard Docker
  3. Push both images to registry
  4. Create docker_manifests to combine both into multi-arch images
  5. Users pull multi-arch images that automatically select the right architecture

Result

  • ✅ Multi-arch support maintained (amd64 + arm64)
  • ✅ No --load flag conflicts
  • ✅ Images pushed directly to registry
  • ✅ Docker manifests work correctly

Technical Details

  • Without use: buildx, GoReleaser uses standard docker build for each architecture
  • The goarch field ensures the correct Go binary is used in each image
  • docker_manifests section creates the multi-arch manifests after individual builds

Fixes #149

Remove `use: buildx` from Docker configuration to fix the --load flag
error that occurs with multi-platform builds.

Problem:
When using buildx with multi-platform builds, GoReleaser tries to use
--load flag which is incompatible with multi-platform images. The
--load flag only works for single-platform builds loaded into the
local Docker daemon.

Solution:
Remove `use: buildx` and let GoReleaser build each architecture
separately using standard Docker build. Each architecture is built
individually, then docker_manifests combines them into multi-arch
manifests.

How it works now:
1. Build linux/amd64 image separately
2. Build linux/arm64 image separately
3. Create docker_manifests to combine both
4. Push multi-arch manifests to registry

This avoids the buildx --load conflict while maintaining multi-arch
support.
@claude

claude Bot commented Nov 25, 2025

Copy link
Copy Markdown

Review

Correct fix. Removing use: buildx solves the --load flag conflict.

GoReleaser builds each arch separately with standard Docker, then combines via manifests (lines 280-299). This is the right approach for multi-arch.

One concern: Dockerfile at .goreleaser.yaml:246,264 uses ubuntu:22.04 base. Consider FROM scratch or alpine for smaller images, unless Ubuntu packages are required.

Ship it.

@wkoszek
wkoszek merged commit b82d345 into main Nov 25, 2025
2 checks passed
@wkoszek
wkoszek deleted the issue/149 branch November 25, 2025 06:57
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 Docker buildx multi-arch build with --load flag error

1 participant