Allow `docker push' to push multiple/a subset of tags
Allow the following usage:
docker push org/image-a:some_tag org/image-b:other_tag
This would make docker push simpler to use in systems that need to build and push multiple images to dockerhub by obviating the need to wrap docker push in a loop.
@dnephin, super cool tool! imma try it out. for my educational purposes, i'm going to implement this feature. :)
Also it can save resources while building - the same image does not have to be uploaded twice.
Prior discussions on this feature can be found in https://github.com/moby/moby/issues/7336, https://github.com/moby/moby/pull/11682, https://github.com/moby/moby/issues/16106, and related, https://github.com/moby/moby/issues/23383
Note that adding support for this on the command-line will not provide enhancements other than not having to "loop" through tags for pushing (see https://github.com/docker/cli/pull/458#pullrequestreview-57642310)
I wonder how that ticket is still open. it started in 2014.. was a quest to finally find the last instance here :) Anyway. Im in for it.
I wonder how that ticket is still open. it started in 2014.. was a quest to finally find the last instance here :) Anyway. Im in for it.
+1
It's curious/weird how you can tag multiple tags at once with docker build -t, but you can't publish them all at once...
Guys what the progress on this issue? Still need docker push with multiple tags!
This, please!
+1
+1
How is this still a thing?
There's currently the PR https://github.com/docker/cli/pull/458#pullrequestreview-57642310 which is under review. AFAIK for now it only adds a loop for the docker push instead of trying to do it in parallel, which is how it works in docker build; that's why it isn't still accepted.
Oh its open. I though its already implemented :(
Ignoring the performance, the options either to push image with all tags or single tag seems bit odd.
You can install dokr . and use dokr dock --push image_name. This will push your multiple images
Please do this at least, so many time since this started, I was thinking it's already implemented.
+1
This is more of a design problem. I'd blindly assumed that this would have worked for me
$ docker push $(docker images --format "{{.Repository}}" | grep "foobar")
only to realize it takes just one argument. I'd say the same for docker pull. There are just too many great use cases for a multi-push. Plus, it's pretty neat instead of a
$ for i in `docker images --format "{{.Repository}}" | grep "foobar"; do docker push $i; done
Not very command-like.
@achillesrasquinha
Is it not necessary pass the tag?
Example:
docker images --format "{{.Repository}}:{{.Tag}}" | grep "foobar"
lagden/foobar:6.1.0
lagden/foobar:latest
I was able to do this using AWS ECR for our docker image hosting. We're using jenkins for CI to push the image up to ECR once the build is finished. Then you can use aws cli to re-tag the image with whatever you want, including variables.
In this example, push your initial image up with the latest tag, then specify whatever additional tag you'd like in the second command behind --image-tag
MANIFEST=\$(aws ecr batch-get-image --repository-name yeet --image-ids imageTag=latest --query 'images[].imageManifest' --output text)
aws ecr put-image --repository-name yeet --image-tag v_$BUILD_NUMBER --image-manifest "\$MANIFEST"
We're using ECS for hosting so this actually fit nicely into our pipe. You can still use amazon ECR if you're hosting elsewhere though.
Any new?!
I achieve this by using pipes with echo and xargs, but it really needs to be implemented, this only automate it, but the command is summoned each time.
If anyone wondering:
echo 'repo/flavor:tag' 'repo/flavor:tag' 'repo/flavor:tag' | xargs -n 1 docker push
Any news on this?
Abandon hope all ye who enter here.
I've had great success using skopeo which allows flexible manipulation of remote docker image registries, like re-tagging images on remotes without needing to push/pull locally, or pushing/pulling multiple images in parallel, etc.
@davidtabernerom 's workaround fixes it :) But hopefully this gets implemented in future
The problem with the workaround is you can't say "push exactly this version of this image to these tags on the remote" — if you have multiple processes or threads on a machine then they can stomp on the local tags before, while, or after each push to the remote, so you may get tags on the remote which point to different images. :-(
To avoid unnecessary repetitions, use this Bash expansion syntax:
echo repo/flavor:{1.0.0,1.2.3} | xargs -n 1 docker push
# or
echo repo/{foo,bar}:1.2.3 | xargs -n 1 docker push
# or even
echo repo/{foo,bar}:{1.0.0,1.2.3} | xargs -n 1 docker push
I solved the problem by the following: docker push [REPOSITORY]
example: localhost:5000/someRepo:tag1 localhost:5000/someRepo:tag2 localhost:5000/someRepo:tag3
The following will push all the above example images to the REPOSITORY docker push localhost:5000/someRepo
As a result tag1, tag2, and tag3 will be pushed to the REPO "localhost:5000/someRepo" recursively.
I solved the problem by the following: docker push [REPOSITORY]
example: localhost:5000/someRepo:tag1 localhost:5000/someRepo:tag2 localhost:5000/someRepo:tag3
The following will push all the above example images to the REPOSITORY docker push localhost:5000/someRepo
As a result tag1, tag2, and tag3 will be pushed to the REPO "localhost:5000/someRepo" recursively.
Thanks! This works perfectly in our build environment.
With the solution of @msbenjamin12 this issue seems resolved.
No, that pushes ALL tags for a repository. For us at least we want to be able to push multiple specific tags, but not just blanket push the entire repo.