docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit
Apache License 2.0
3.58k stars 482 forks source link

Multi-platform builds are not visible in the local Docker image registry #2707

Open asreich opened 2 months ago

asreich commented 2 months ago

Description

Problem: When running docker buildx build targeting multiple architectures the resulting images cannot be viewed in docker image ls. This works if you only target ONE platform per docker buildx build command, but not multiple.

I've read all of #166 and I understand the initial question was resolved but I haven't been able to find a followup issue for the related problem listed above. I have looked through the buildx CLI and have been unable to find a similar command to docker image ls that lists images instead of the buildx drivers listed by docker buildx ls.

Are there plans to enable this support in an upcoming release?

tonistiigi commented 1 month ago

@thaJeztah Transfer to moby? (Afaik this works with containerd store).

toby-griffiths commented 2 weeks ago

Pardon my ignorance if I've got this wrong, but I thought you had to use --load to have then appear at all in the local images list?

thaJeztah commented 2 weeks ago

The --load option is needed if you are using a custom builder; e.g. if you created a builder using docker buildx create a separate instance of the BuildKit daemon is created that's running inside a container. In that case the BuildKit builder runs isolated from the Docker Engine and doesn't share the image store. When running a docker buildx build with that builder, result of the build only remains in the builder's cache, unless you either --push the result or --load the result into the Docker Engine.

If you use the default builder (the BuildKit instance that's compiled into the Docker Engine itself), it's not needed to --load the image, because BuildKit in that case shares the image store with the Docker Engine. However for multi-platform builds, you need to have the containerd image store enabled to allow the Docker Engine's image store to preserve multi-platform images (without the containerd image store, it can only store a single platform per image);

With the containerd image store enabled, you don't need a custom builder for building multi-platform images (so you can use docker builder use default to use the built-in version of BuildKit)