Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Save and reload multi-platform images #393

Open
mortenlj opened this issue Sep 15, 2020 · 2 comments
Open

Feature request: Save and reload multi-platform images #393

mortenlj opened this issue Sep 15, 2020 · 2 comments

Comments

@mortenlj
Copy link

A common pattern I've used a lot is to have a two step build pipeline. The first step is to build the docker image and run tests etc. The second step is only run if some condition is true, and pushes the image to a registry.

When using buildx to build a multi-platform image, I can't seem to find a set of commands that allows me to do this. There are several output options that will save a multi-platform image to disk, either as a file tree, a tarball, or an OCI Image tarball. But I haven't been able to find a way to take that output and upload it to a registry in the next step.

Crucially, I don't want to run the build again, because that will happen in a different runner without any cache. Running the build again opens up the possibility that something changes, and then you push an untested image to the registry.

The way I do this with normal docker and single-platform images:

First step:

  • docker build . --tag "${IMAGE_NAME}:${TAG}" --tag "${IMAGE_NAME}:latest"
  • Run various tests
  • docker image save "${IMAGE_NAME}:${TAG}" "${IMAGE_NAME}:latest" | bzip2 > docker.tar.bz2
  • Save docker.tar.bz2 to suitable artifact storage

Second step:

  • Fetch docker.tar.bz2 from artifact storage
  • bunzip2 --stdout docker.tar.bz2 | docker image load
  • docker push "${IMAGE_NAME}"
@GeorgeHahn
Copy link

I have the same request, but for a slightly different reason: CI time & code reduction. I would like to avoid running the same build twice in CI, and it would be nice to define the build a single time and share it across multiple tagging & deployment jobs.

@quite
Copy link

quite commented Mar 17, 2022

Hm. Does this issue cover the case where one wants to save out architecture specific images from the cache that buildx produced. I'd like to do docker save for each architecture specific image that buildx build --platform foo,bar produced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants