buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Load image into buildx builder instance

Open leighmcculloch opened this issue 2 years ago • 10 comments

I've built an image using docker buildx build that I exported to a file, and for a subsequent build that's running on another machine I need to import/load that first image into the builder so it has access to it.

As far as I can tell there is no way to tell docker load -i image to load the image into the buildx builder.

This seems like a missing feature in the buildx functionality that would be valuable for builds that depend on local images that need to be loaded when a registry cannot be used for the intermediary image.

leighmcculloch avatar Nov 17 '21 19:11 leighmcculloch

@leighmcculloch https://github.com/docker/buildx/issues/159#issuecomment-539238262

crazy-max avatar Nov 18 '21 15:11 crazy-max

@crazy-max is there any scope for the docker-container driver supporting building from local images in the future?

By switching to using the docker driver to achieve this you end up losing support for a bunch of other stuff (multi-arch builds, registry caching).

zachary-povey avatar Nov 18 '21 15:11 zachary-povey

Thanks @crazy-max. @tonistiigi also discussed with me in the buildkit Slack channel and helped me understand where the capabilities are and aren't. If there's plan to support loading images into buildx builders in the future it'd be great to keep this issue open. Or if that is not part of the plan, please close.

leighmcculloch avatar Nov 18 '21 20:11 leighmcculloch

See also #186 (closed, but not resolved) and #430.

AlekSi avatar Jan 28 '22 17:01 AlekSi

@AlekSi I've read the other issues but it is unclear where it's going. Is it closed as won't fix? Just so I understand if this is likely to be something in the future or not. Thanks!

leighmcculloch avatar Jan 28 '22 18:01 leighmcculloch

I don't know; I'm just a user with this or a similar problem, doing a cross-linking. :)

AlekSi avatar Jan 28 '22 18:01 AlekSi

This is a bit of an issue for containers built with Nix as well, and makes docker/build-push-action@v2 less than useful

dmadisetti avatar May 02 '22 17:05 dmadisetti

@leighmcculloch could you tell me please, have you found a way to overcome this issue?

I want to do almost the same thing, but between different GitHub jobs. So, one job builds an image, uploads it as an artifact, another job downloads this image and wants to use this image as a base image for another image. @crazy-max maybe you could help me?

mathbunnyru avatar May 12 '22 15:05 mathbunnyru

@mathbunnyru I found no way to do this with buildx and it sounded like from discussions on the Docker Slack that there isn't plans to support it.

What I ended up doing was using buildx for my builds with no dependencies, and then plain old build for the image build that needed to pull in the others. See here: https://github.com/stellar/quickstart/blob/68fa964e61e58e57fa3d1dd58bc13d4b4ab0633c/.github/workflows/Dockerfile.dev.yml

leighmcculloch avatar Nov 19 '22 21:11 leighmcculloch

@mathbunnyru I found no way to do this with buildx and it sounded like from discussions on the Docker Slack that there isn't plans to support it.

What I ended up doing was using buildx for my builds with no dependencies, and then plain old build for the image build that needed to pull in the others. See here: https://github.com/stellar/quickstart/blob/68fa964e61e58e57fa3d1dd58bc13d4b4ab0633c/.github/workflows/Dockerfile.dev.yml

Got it, thank you. I ended up using ARM runners for GitHub actions and using docker save and uploading and downloading artifacts. It's a bit slow, but works really well.

mathbunnyru avatar Nov 20 '22 14:11 mathbunnyru