Skip to content

Fix Docker buildx multi-arch build with --load flag error #149

Description

@wkoszek

Docker builds are failing with buildx because of the --load flag which is incompatible with multi-platform builds.

Error

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

Root Cause

When building multi-platform images with buildx, the --load flag cannot be used. Multi-platform builds must be pushed directly to a registry, they cannot be loaded into the local Docker daemon.

From Docker docs:

The --load flag is not supported with multi-platform builds. To use multi-platform builds, you must push images to a registry.

Current Configuration

We're using:

dockers:
  - use: buildx
    goarch: arm64
    build_flag_templates:
      - "--platform=linux/arm64"

Solution

For multi-platform buildx builds, we should NOT load images locally. They should be pushed directly. GoReleaser may be automatically adding --load which conflicts with buildx multi-platform mode.

Options:

  1. Don't use buildx (go back to regular docker build for single platform)
  2. Use buildx but ensure images are pushed, not loaded
  3. Build each architecture separately without buildx, then create manifests

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