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

Most upvoted comments

you should use --push on multi-platform , use --load for single platform。

@git-developer The current limitation is combination of --load and multiple values to --platform. Eg. --platform linux/arm64 --load works 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:

# build both images
docker buildx build --platform linux/arm64,linux/amd64 .
# load just one platform
docker buildx build --load --platform linux/amd64 -t my-image-tag .
# optionally load another platform with a different tag
docker buildx build --load --platform linux/arm64 -t my-image-tag:arm64 .
# push both platforms as one image manifest list
docker buildx build --push --platform linux/arm64,linux/amd64 -t docker.palantir.build/publish:tag .

Unfortunately the docker daemon does not support tags pointing at a manifest list, rather than a manifest. Which is why if you do:

docker pull --platform linux/arm64 ubuntu:20.04
docker pull --platform linux/amd64 ubuntu:20.04

It will retag the local ubuntu:20.04 image each time rather than have ubuntu:20.04 point to a manifest list.

This is still a problem in 2023, if this feature is complete already, why isn’t it merged and available?

[…] trying to build multi-arch image and loading to local docker instance for testing purposes.

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 platform parameter on load. Example:

  • Build: docker buildx build --platform linux/arm64,linux/amd64 -t foo/bar:latest .
  • Test: 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:

  • run tests are part of the build
  • build single arch image, test with docker run, then build multi-arch image. Cache from the first build will be reused.
  • use a local registry

Heya folks 👋

Though I’d x-post my comment from #1220 since it seems relevant:

This is actually in progress, see https://github.com/docker/roadmap/issues/371. This is not a buildx/buildkit limitation so we can’t do much until that’s completed, since it’s an issue that docker currently can’t store multi-arch images in the content store - but as mentioned, can confirm this work is now in-progress. TL;DR - the migration to the containerd store will allow loading multi-arch images, so --load will load multi-arch images properly.

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 --platform specified with multiple platforms and --load would only load the one the local docker arch supports? This would allow to build and load in one command which is very handy

How 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…

 => 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
Build failed
make: *** [build] Error 3

Here’s my environment:

docker version

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:34 2019
 OS/Arch:           darwin/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:29:19 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

docker buildx version

github.com/docker/buildx v0.3.1-tp-docker 6db68d029599c6710a32aa7adcba8e5a344795a7

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?

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?

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 buildx in 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:

  • enable “User containerd for pulling and storing images” in Settings > Features in development > Beta features

image

Would it be possible to put in some logic on the buildx side to have --load only 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:

- name: Build the image
  uses: docker/build-push-action@v5
  with:
    context: .
    platforms: linux/amd64, linux/arm64
    load: true

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 --load it 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 --load would 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;

docker buildx create --use
competent_tesla

echo -e 'FROM alpine\nRUN echo foo > world\n' | docker buildx build --platform linux/arm64,linux/amd64 --load -t myimage -
[+] Building 6.3s (1/1) FINISHED                                                                           docker-container:gallant_mendel
 => [internal] booting buildkit                                                                                                       6.3s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                    5.9s
 => => creating container buildx_buildkit_gallant_mendel0                                                                             0.4s
ERROR: docker exporter does not currently support exporting manifest lists

✅ 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.

docker buildx create --use
competent_tesla

echo -e 'FROM alpine\nRUN echo foo > world\n' | docker buildx build --platform linux/arm64,linux/amd64 --load -t myimage -
[+] Building 17.3s (12/12) FINISHED                                                                               docker-container:competent_tesla
 => [internal] booting buildkit                                                                                                               8.6s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                            8.1s
 => => creating container buildx_buildkit_competent_tesla0                                                                                    0.5s
 => [internal] load build definition from Dockerfile                                                                                          0.0s
 => => transferring dockerfile: 71B                                                                                                           0.0s
 => [linux/amd64 internal] load metadata for docker.io/library/alpine:latest                                                                  7.8s
 => [linux/arm64 internal] load metadata for docker.io/library/alpine:latest                                                                  7.5s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                             0.0s
 => => transferring context: 2B                                                                                                               0.0s
 => [linux/arm64 1/2] FROM docker.io/library/alpine:latest@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099            0.3s
 => => resolve docker.io/library/alpine:latest@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099                        0.0s
 => => sha256:52f827f723504aa3325bb5a54247f0dc4b92bb72569525bc951532c4ef679bd4 3.99MB / 3.99MB                                                0.2s
 => => extracting sha256:52f827f723504aa3325bb5a54247f0dc4b92bb72569525bc951532c4ef679bd4                                                     0.0s
 => [linux/amd64 1/2] FROM docker.io/library/alpine:latest@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099            0.5s
 => => resolve docker.io/library/alpine:latest@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099                        0.0s
 => => sha256:1f3e46996e2966e4faa5846e56e76e3748b7315e2ded61476c24403d592134f0 3.64MB / 3.64MB                                                0.4s
 => => extracting sha256:1f3e46996e2966e4faa5846e56e76e3748b7315e2ded61476c24403d592134f0                                                     0.1s
 => [linux/arm64 2/2] RUN echo foo > world                                                                                                    0.1s
 => [linux/amd64 2/2] RUN echo foo > world                                                                                                    0.1s
 => exporting to oci image format                                                                                                             0.2s
 => => exporting layers                                                                                                                       0.0s
 => => exporting manifest sha256:4d0f80eb6bfbad75574a8f065b466b0e5c889958d319483299a633d6a3f38cef                                             0.0s
 => => exporting config sha256:a5234e3bad6fffa52363de0056874cf063592db0c3a233633392f4c72973ff6a                                               0.0s
 => => exporting attestation manifest sha256:96dd7b7a7ef12fca0f6e90b831423ee15869a80f3964c0037401f6f488d12033                                 0.0s
 => => exporting manifest sha256:c10ae10bc386d455c0a1927f084dbefc443189cc08ece140c60c7f200651da95                                             0.0s
 => => exporting config sha256:83e4aea73a3c6887b176659da35b8ae71f1b0cec1a4c8fa4ec65c546942f445f                                               0.0s
 => => exporting attestation manifest sha256:130a70b98fdac58cbeedfbf16542896ccaaa34e3f057fc83fa36dd8fe82b578a                                 0.0s
 => => exporting manifest list sha256:b9e0021de97c0783457abc25ad293ade6e50dff72b6ddc1ce1f56c86966dc199                                        0.0s
 => => sending tarball                                                                                                                        0.2s
 => importing to docker                                                                                                                       0.0s


docker image ls --tree myimage
IMAGE                ID             DISK USAGE   CONTENT SIZE   IN USE
myimage:latest       b9e0021de97c       16.5MB         7.64MB
├─ linux/arm64       4d0f80eb6bfb       12.8MB         3.99MB
└─ linux/amd64       c10ae10bc386       3.64MB         3.64MB

💡💡💡 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 create is no longer needed, and the default will work;

docker buildx ls
NAME/NODE           DRIVER/ENDPOINT     STATUS    BUILDKIT          PLATFORMS
default*            docker
 \_ default          \_ default         running   v0.18.2           linux/amd64 (+2), linux/arm64, linux/ppc64le, linux/s390x, (2 more)


✅ With the above, docker build (or docker buildx build) will do multi-platform builds, and the --load option is not needed when using the default builder;

echo -e 'FROM alpine\nRUN echo foo > world\n' | docker build --platform linux/arm64,linux/amd64 -t myimage -
[+] Building 6.6s (10/10) FINISHED                                                                                          docker:default
 => [internal] load build definition from Dockerfile                                                                                  0.0s
 => => transferring dockerfile: 71B                                                                                                   0.0s
 => [linux/amd64 internal] load metadata for docker.io/library/alpine:latest                                                          5.6s
 => [linux/arm64 internal] load metadata for docker.io/library/alpine:latest                                                          0.0s
 => [internal] load .dockerignore                                                                                                     0.0s
 => => transferring context: 2B                                                                                                       0.0s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                         0.0s
 => [linux/amd64 1/2] FROM docker.io/library/alpine:latest@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45    0.6s
 => => resolve docker.io/library/alpine:latest@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45                0.3s
 => => sha256:38a8310d387e375e0ec6fabe047a9149e8eb214073db9f461fee6251fd936a75 3.64MB / 3.64MB                                        0.2s
 => => extracting sha256:38a8310d387e375e0ec6fabe047a9149e8eb214073db9f461fee6251fd936a75                                             0.1s
 => [linux/arm64 1/2] FROM docker.io/library/alpine:latest@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45    0.2s
 => => resolve docker.io/library/alpine:latest@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45                0.2s
 => [linux/arm64 2/2] RUN echo foo > world                                                                                            0.2s
 => [linux/amd64 2/2] RUN echo foo > world                                                                                            0.1s
 => exporting to image                                                                                                                0.1s
 => => exporting layers                                                                                                               0.0s
 => => exporting manifest sha256:83c75be9de6292c8784a7348083d10ab208b56defa9fa63f1c4dfa3f4ce2b22b                                     0.0s
 => => exporting config sha256:c50e646a64fbf8c7f67172932ee1e7e0ca2acd721622034b018fa312f3149b7b                                       0.0s
 => => exporting attestation manifest sha256:e0414ff2938bceca5f756735736a6fa242dc6429562a501fce51cb6659bbabc3                         0.0s
 => => exporting manifest sha256:2bf9e92542e1cb89294516616c537df85dbe6e09cda4660996ceb5bb5ad2c8d3                                     0.0s
 => => exporting config sha256:61996b4d135d8fa98d962ae715288b87382442409b799c1c08b9241aed88259b                                       0.0s
 => => exporting attestation manifest sha256:18a70898ca31e74138870d4296b3910ccd0d499857635a56d0b6020c07876c0a                         0.0s
 => => exporting manifest list sha256:dcf27d0b7b0811056692c3baed43bffe5c43bec262bcd10a510bec8f8165a315                                0.0s
 => => naming to docker.io/library/myimage:latest                                                                                     0.0s
 => => unpacking to docker.io/library/myimage:latest                                                                                  0.0s

docker image ls --tree myimage
IMAGE                ID             DISK USAGE   CONTENT SIZE   IN USE
myimage:latest       dcf27d0b7b08       16.5MB         7.64MB
├─ linux/arm64       83c75be9de62       12.8MB         3.99MB
└─ linux/amd64       2bf9e92542e1       3.65MB         3.65MB

Looks like with Docker Desktop 4.29.0 we now have this option in general settings:

image

Why is this closed? It still occurs.

@Filius-Patris You’re options are:

  • run tests are part of the build
  • build single arch image, test with docker run, then build multi-arch image. Cache from the first build will be reused.
  • use a local registry

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?

This worked for me:

* enable "User containerd for pulling and storing images" in Settings > Features in development > Beta features

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 containerd image store?

@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 .