Add remote tag to docker image

In the private registry (myregistry.com), let's say I have an image with the tag 'v1.2.3'. Then I push him:

docker push myregistry.com/myimage:v1.2.3

If I want to link another tag, say 'staging' and click this tag in my registry, I can:

docker tag myregistry.com/myimage:v1.2.3 myregistry.com/myimage:staging docker push myregistry.com/myimage:staging

Although this works, the second docker push still goes through each image, trying to push it (although skipping the download). Is there a better way to add a remote tag?

+6
source share
1 answer

As you said, docker tag ...; docker push ... docker tag ...; docker push ... is the best way to add a tag to an image and share it.

In the specific example you provided, both tags were in the same repo ( myregistry.com/myimage ). In this case, you can just docker push myregistry.com/myimage , and by default, the docker daemon will delete all tags for the repo at the same time, preserving the iteration over the layers for the common layers.

You can use the same process ( docker tag ...; docker push ... ) to tag images between repositories, for example.

 docker tag myregistry.com/myimage:v1.2.3 otherregistry.com/theirimage:v2 docker push otherregistry.com/theirimage 
+8
source

Source: https://habr.com/ru/post/977779/


All Articles