buildx
buildx copied to clipboard
Can you split up the build and push steps?
Related to #166
I want to first build the image, then do some other release steps and then release the image to docker hub.
For that, I thought I should use -o type=image,name=xxx
.
But when I run docker manifest inspect xxx
after that, it just returns the latest manifest from docker hub.
Where is the built manifest, and how can I push it after the build?
I am building for
--platform linux/amd64,linux/arm/v7,linux/arm64/v8
if that is important.
To push from buildx you would run the build again with push option. If you have image in docker then you do docker push
. If you have exported image in some other way(local registry, oci tarball) then there are external programs that can push from one registry to another etc.
Thank you for your answer! Why is there no option to create the manifest and save it locally, so that it can later be picked up again? Or is that something that is technically not possible?
@tonistiigi What is the best output format and external program for outputting a multi-platform image and later pushing it to docker hub? As far as I read there are still problems with pushing OCI images to docker hub: https://github.com/docker/hub-feedback/issues/1871
Building again with --cache-from
and --push
isn't very great because I'm using a multi-stage build, and only the first stage hits the cache.
Thank you for your answer! Why is there no option to create the manifest and save it locally, so that it can later be picked up again? Or is that something that is technically not possible?
@MauriceNino Hello, Have you received any answers to this question? I want the build and the push to be separated, too. Is there another way without using the --push option?
Also interested. GitHub repository often returns errors, and I'll be interested in separating the build and push to be able to backoff retry the push step.
Yeah, this becoming a necessity. There should be a method to build a multi arch image, and then push at a later time. I agree with @MauriceNino this is needed for additional CI processes.
Another reason for the separation is that I would like to run those steps in parallel:
- terraform apply that also creates the ECR repository,
- in the meantime I want to start the docker build.
When the terraform apply has finished I can push the image to the newly created repository.
@tonistiigi
To push from buildx you would run the build again with push option....
I would be concerned if I build again that it would be possible for something pulled in to do the build again would have changed in the interim. It's unlikely if the interim is short, but not impossible.
Hello, I'm also intéressée on this topic. I want to build, then test and then push. Any workaround on that ?
@tonistiigi
To push from buildx you would run the build again with push option....
I would be concerned if I build again that it would be possible for something pulled in to do the build again would have changed in the interim. It's unlikely if the interim is short, but not impossible.
If you have already ran the build previously and nothing has changed, then building with the --push
flag will use the cached build (unless you add the --pull
flag, which will attempt to pull any referenced external images)
This issue is related to my discussion about running targets sequentially: https://github.com/docker/buildx/discussions/1976
Also interested, in any pipeline we need security tests after build and before any push to external registry. Any help so far ?
bump
bump
Bump