Docker push: push image once with multiple tags
The docker push command does not accept several arguments (if ever one wants to push a selection of several tags (not all) in one go), so one needs to push each tag separately, e.g.:
for t in latest v1.1 dev; do
docker push "repo:${t}"
done
Otherwise, as mentioned in @GuillaumePancak's answer, one may be interested in relying on the --all-tags
flag available from Docker 20.10.0.
Note also that it is frequent to consider pushing several different tags for the same image (which may be your use case here as well). In this case pushing these tags successively (and not at the same time with several concurrent processes) ensures the docker push
of the tag synonyms will be almost immediate, after the image has been pushed once with a given tag.
If you want to push all tags for an image, you can use the --all-tags
option:
docker image push --all-tags repository/image_name
This option is supported for Docker 20.10 and newer. The same behaviour can be achieved by omitting --all-tags
on older versions.
More information: Docker push documentation
There is currently a change to push multiple image in the same time, which is in review.
But it only adds a loop for the docker push
instead of parallelizing them.
So right now, the unique solution is to push each tag separately.