buildx: Building images for multi-arch with --load parameter fails
While trying to build images for multi-architecture (AMD64 and ARM64), I tried to load them into the Docker daemon with the --load parameter but I got an error:
➜ docker buildx build --platform linux/arm64,linux/amd64 --load -t carlosedp/test:v1 .
[+] Building 1.3s (24/24) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 115B 0.0s
=> [linux/amd64 internal] load metadata for docker.io/library/alpine:latest 0.8s
=> [linux/amd64 internal] load metadata for docker.io/library/golang:1.12-alpine 1.0s
=> [linux/arm64 internal] load metadata for docker.io/library/golang:1.12-alpine 1.2s
=> [linux/arm64 internal] load metadata for docker.io/library/alpine:latest 1.2s
=> [linux/amd64 builder 1/5] FROM docker.io/library/golang:1.12-alpine@sha256:1a5f8b6db670a7776ce5beeb69054a7cf7047a5d83176d39b94665a54cfb9756 0.0s
=> => resolve docker.io/library/golang:1.12-alpine@sha256:1a5f8b6db670a7776ce5beeb69054a7cf7047a5d83176d39b94665a54cfb9756 0.0s
=> [linux/amd64 stage-1 1/4] FROM docker.io/library/alpine@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913 0.0s
=> => resolve docker.io/library/alpine@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 232B 0.0s
=> CACHED [linux/amd64 stage-1 2/4] RUN apk add --no-cache file && rm -rf /var/cache/apk/* 0.0s
=> CACHED [linux/amd64 builder 2/5] WORKDIR /go/src/app 0.0s
=> CACHED [linux/amd64 builder 3/5] ADD . /go/src/app/ 0.0s
=> CACHED [linux/amd64 builder 4/5] RUN CGO_ENABLED=0 go build -o main . 0.0s
=> CACHED [linux/amd64 builder 5/5] RUN mv /go/src/app/main / 0.0s
=> CACHED [linux/amd64 stage-1 3/4] COPY --from=builder /main /main 0.0s
=> [linux/arm64 builder 1/5] FROM docker.io/library/golang:1.12-alpine@sha256:1a5f8b6db670a7776ce5beeb69054a7cf7047a5d83176d39b94665a54cfb9756 0.0s
=> => resolve docker.io/library/golang:1.12-alpine@sha256:1a5f8b6db670a7776ce5beeb69054a7cf7047a5d83176d39b94665a54cfb9756 0.0s
=> [linux/arm64 stage-1 1/4] FROM docker.io/library/alpine@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913 0.0s
=> => resolve docker.io/library/alpine@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913 0.0s
=> CACHED [linux/arm64 stage-1 2/4] RUN apk add --no-cache file && rm -rf /var/cache/apk/* 0.0s
=> CACHED [linux/arm64 builder 2/5] WORKDIR /go/src/app 0.0s
=> CACHED [linux/arm64 builder 3/5] ADD . /go/src/app/ 0.0s
=> CACHED [linux/arm64 builder 4/5] RUN CGO_ENABLED=0 go build -o main . 0.0s
=> CACHED [linux/arm64 builder 5/5] RUN mv /go/src/app/main / 0.0s
=> CACHED [linux/arm64 stage-1 3/4] COPY --from=builder /main /main 0.0s
=> ERROR exporting to oci image format 0.0s
------
> exporting to oci image format:
------
failed to solve: rpc error: code = Unknown desc = docker exporter does not currently support exporting manifest lists
I understand that the daemon can’t see the manifest lists but I believe there should be a way to tag the images with some variable, like:
docker buildx build --platform linux/arm64,linux/amd64 --load -t carlosedp/test:v1-$ARCH .
To have both images loaded into the daemon and ignoring the manifest list in this case.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 77
- Comments: 50 (5 by maintainers)
Commits related to this issue
- refactor: use runner platform only as long as docker/buildx#59 is open — committed to git-developer/docker-support by git-developer 7 years ago
- Build ARM docker images (#4794) Build ARM docker images in the release workflow. # Changes: - Add a new env key `DOCKER_MULTIARCH` and `DOCKER_PUSH`. When set, it will build multi-arch images and... — committed to linkerd/linkerd2 by aliariff 6 years ago
- Doesn't work (yet?) with multi-arch... See https://github.com/docker/buildx/issues/59 — committed to thijsputman/tc66c-mqtt by thijsputman 6 years ago
- Support push multiple arch images --push for multi-platform and --load for single platform https://github.com/docker/buildx/issues/59#issuecomment-659303756 — committed to halfcrazy/drone-docker-buildx by halfcrazy 6 years ago
- Support push multiple arch images --push for multi-platform and --load for single platform https://github.com/docker/buildx/issues/59#issuecomment-659303756 — committed to halfcrazy/drone-docker-buildx by halfcrazy 6 years ago
- ref: https://github.com/docker/buildx/issues/59 since --load with multi platforms doesn't work, build twice, which uses cache to push to second repo — committed to naemono/cloud-on-k8s by naemono 5 years ago
- Also Release Images to DockerHub (#4994) * Also push to dockerhub when running ci-release target Use secret/release/docker-hub path in vault to get dockerhub credentials In docker-multiarch-build t... — committed to elastic/cloud-on-k8s by naemono 5 years ago
- Remove test step because of https://github.com/docker/buildx/issues/59 — committed to lycheeverse/lychee by mre 5 years ago
- Use include+ instead of multi-stage build Multi-stage builds are difficult when building multi-platform, see e.g. https://github.com/docker/buildx/issues/59 Using dockerfile include+ feature instead... — committed to finn-no/node-docker by henrik242 5 years ago
- (maint) Fix multiple architecture Docker builds - Using different tags for different architectures is wrong. Tags in Docker support multiple architectures. Using one buildx command for multip... — committed to puppetlabs/r10k by Iristyle 5 years ago
- (maint) Fix multiple architecture Docker builds - Using different tags for different architectures is wrong. Tags in Docker support multiple architectures. Using one buildx command for multip... — committed to puppetlabs/r10k by Iristyle 5 years ago
- limit platforms for early build It will probably fail faster if we don't build all three platforms, and the 'load' parameter will actually work, since you can't load a manifest that is multiarch I gu... — committed to kingdonb/podinfo by deleted user 5 years ago
- Remove --load option as this is not supported for multiarch manifest lists docker/buildx#59 — committed to aleskandro/fortio by aleskandro 5 years ago
- Adds --load option only when a single platform is set in BUILDX_PLATFORMS docker/buildx#59 — committed to aleskandro/fortio by aleskandro 5 years ago
- Multiarch enablement on Dockerfile and Dockerfile.build (#538) * Enabling multiarch on Dockerfile and Dockerfile.build - Switching build image to golang:1.17.8 - Changes golangci-lint installatio... — committed to fortio/fortio by aleskandro 5 years ago
- Fix "docker exporter does not currently support exporting manifest lists" See https://github.com/docker/buildx/issues/59, esp. https://github.com/docker/buildx/issues/59#issuecomment-616050491. — committed to webfactory/docker-psalm by mpdude 5 years ago
- limit platforms for early build It will probably fail faster if we don't build all three platforms, and the 'load' parameter will actually work, since you can't load a manifest that is multiarch I gu... — committed to kingdonb/podinfo by deleted user 5 years ago
- Do test only on arm64 because of docker/buildx#59 — committed to metanorma/metanorma-docker by CAMOBAP 5 years ago
- fix: --load don't work in combination with multiple platforms https://github.com/docker/buildx/issues/59#issuecomment-1168619521 `You can do this: # build both images docker buildx build --platfo... — committed to djimenezc/docker-multi-arch by djimenez-savi 4 years ago
- Add comment : issue with multi-arch build + load See : - https://github.com/docker/buildx/issues/59 — committed to ghusta/docker-postgres-world-db by ghusta 4 years ago
you should use
--pushon multi-platform , use--loadfor single platform。@git-developer The current limitation is combination of
--loadand multiple values to--platform. Eg.--platform linux/arm64 --loadworks fine.Hi, this issue is 5 months old and the linked issue (moby/moby#38738) is still in Draft. Any news?
https://github.com/docker/buildx/issues/59#issuecomment-488902807
“limitation is temporary” … in 2019.
I’m hitting this as well… any updates?
You can do this:
Unfortunately the docker daemon does not support tags pointing at a manifest list, rather than a manifest. Which is why if you do:
It will retag the local
ubuntu:20.04image each time rather than haveubuntu:20.04point to a manifest list.This is still a problem in 2023, if this feature is complete already, why isn’t it merged and available?
Depending on the use case it may be sufficient when tests run on the runner’s platform only. If so, this issue can be avoided by omitting the
platformparameter on load. Example:docker buildx build --platform linux/arm64,linux/amd64 -t foo/bar:latest .docker buildx build --load -t foo/bar:latest .SOLVED: Docker command: docker buildx build --push --platform linux/amd64,linux/arm64 -t 2{REGISTRY}/{IMAGE}:{TAG} .
Reference Link: https://speedscale.com/blog/how-to-build-multi-arch-docker-images/
Ok lol so this doesn’t work yet after almost three years. Can we ever get it working?
There are very good reasons as multiple people in this thread have pointed out and at the time we didn’t even have Apple Silicon released. Which would make this even more useful.
@Filius-Patris You’re options are:
docker run, then build multi-arch image. Cache from the first build will be reused.Heya folks 👋
Though I’d x-post my comment from #1220 since it seems relevant:
The pipeline in the project I’m working on runs tests before pushing. Do I have to build the image once for the test and then a second time for production?
Is there any workaround to run a multiarch container before pushing it to a repo?
Why it was closed ? Still the issue in 2024
@bmx666 but that’s no solution if you want to use, e.g., docker in a build pipeline.
The limitation is temporary as daemon should get support for loading multi-arch with https://github.com/moby/moby/pull/38738 so I’m a bit hesitant to add a custom implementation for it atm.
Couldn’t it work in a way in which there’s
--platformspecified with multiple platforms and--loadwould only load the one the local docker arch supports? This would allow to build and load in one command which is very handyHow would I tag an image with a version and latest?
I also landed here and I’m not sure what the options are, on a practical level it seems like a hack to support “docker build” commands and docker buildx to get around the issue.
It would be cool if it could “load” multi-arch images, and use only the correct one. So that if you say, re-tag and push, you could do it across architectures.
A lot of code does build/tag/push in separate places.
Hi, I’ve the same issue as the original message, trying to build multi-arch image and loading to local docker instance for testing purposes.
I want to build and execute some local tests before pushing the image to the repository. Previously for this purpose, I had used standard build command (tagging the architecture) with qemu.
Build runs fine, but at the end…
Here’s my environment:
docker version
docker buildx version
IMHIO, this shouldn’t be closed @tonistiigi - this is not “fixed” by a “mention” in the docs. There’s a real need, shown by this long running issue. 3 years…
This was closed because of https://github.com/moby/moby/pull/38738. But now that issue has been closed as development has stopped (https://github.com/moby/moby/pull/38738#issuecomment-1005279865). Can we reopen this one?
Same problem for me, i have to build with --push on each gitlab-ci stages… using --platform linux/arm/v7,linux/amd64
This should not be closed, as there doesn’t seem to be a way currently to tell docker from the CLI only (i.e. in a CI/CD pipeline) to enable the containerd feature. Unless I’m mistaken?
I’m trying to use
buildxin Circle CI to build both AMD64 and ARM64 containers, but unless I start setting up entirely different jobs on different runners, I run into this issue.This worked for me:
Would it be possible to put in some logic on the buildx side to have
--loadonly export the image if the platform matches? Print a warning, fail hard, anything else if none of the platforms specified match OS?This problem just happened to me. Why this issue is closed if issue still exist?
I just want to have the ability to load AND build multi-arch in our pipelines:
It’s doable in 2 steps (build single arch image, test, then build multi-arch image), it just feels like a waste.
I think because it can’t be fixed right? It actually makes sense in that if you build a multi arch image, you can’t
--loadit as local docker doesn’t support having multi-arch images (when you do a docker pull it’ll pull a single arch based on your system). So best case--loadwould have to just load the architecture for your current host.So, this scenario is supported now if the docker engine is configured to use the containerd image store;
@crazy-max @thompson-shaun wondering if we also should provide information about that (and/orr add a link to the documentation?)
❌ Without the containerd image store enabled, it still produces an error;
✅ With the containerd image store enabled, the docker engine is able to store multi-platform images, and as such can load them when you’re using a separate container builder.
💡💡💡 But also worth mentioning that with with the containerd image store enabled, the default BuildKit builder included in the Docker Engine itself can build multi-arch images (assuming QEMU binfmt userland emulation is installed), so in that case,
docker buildx createis no longer needed, and the default will work;✅ With the above,
docker build(ordocker buildx build) will do multi-platform builds, and the--loadoption is not needed when using the default builder;Looks like with Docker Desktop 4.29.0 we now have this option in general settings:
Why is this closed? It still occurs.
I would like to know more about the “use a local registry” option, please.
Hi All,
does anyone know the solution to the above problem? I can push images to the registry without any issue but when I try to load them on the docker desktop I face the below issue, which is same as above.
error: docker exporter does not currently support exporting manifest lists@skhamkar-tibco i don’t know of a way. Currently you can’t use —load with cross-platform builds.
Just came here as I was using the GitHub Action. May I propose adding a more helpful error message pointing to some docs or even a specific, chosen comment from this thread to help people solve instead of Googleing and skimming through ~300 comments and also adding more spam to this already busy issue?
Thanks a lot! It works!
Hello @ShlomoCode!
To use containerd in build-puh-action I believe you need to use the docker/setup-docker-action to configure the containerd store before using build-push-action. The README example is to enable the containerd snapshotter.
@thaJeztah Thank you! Can you give a minimal example of how to use this in GitHub Actions, i.e. how to configure the https://github.com/docker/build-push-action action to use the
containerdimage store?@christhomas see https://github.com/docker/roadmap/issues/371.
@sakoht
docker buildx build --platform linux/arm64,linux/amd64 -t "${image_name}:${GOOS}-${GOARCH}" --push .The above commands work perfectly, I can see images in the registry. But I want to inspect them locally and then push them to the registry. But when I execute the below command it gives the issue mentioned on this thread.docker buildx build --platform linux/arm64,linux/amd64 -t "${image_name}:${GOOS}-${GOARCH}" --load .But again when I provide a single platform, It works perfectly and I can see the image in Docker Desktop. Like this -
docker buildx build --platform linux/arm64 -t "${image_name}:${GOOS}-${GOARCH}" --load .