Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

do I need to manually tag "latest" when pushing to docker public repository?

Suppose I have an image me/mystuff:v0.0.1

I find if I push it to the repository:

docker push me/mystuff:v0.0.1  

latest is not created, and on a pull from another machine it will complain, e.g.

ssh me@faraway (faraway)  $ docker run -it me/mystuff /bin/bash 

will result in a not found error for me/mystuff:latest

I can add the latest tag and push explicitly to the public repository:

docker login me docker tag me/mystuff:v0.0.1 me/mystuff:latest docker push me/mystuff:latest 

and then from another machine:

docker pull me/mystuff 

will work because latest exists.

I am also finding that once latest exists, it does not auto update when a new numbered version is pushed.

Can I somehow eliminate this step of manually tagging latest and have latest automatically point to the latest numbered version?

Or is it there for a reason, like allowing the separation of development versions (tagged with a vN.N.N only) from the production version (tagged latest)?

like image 381
Paul Avatar asked Dec 24 '14 23:12

Paul


People also ask

Does Docker push automatically tag latest?

The trick is of course, if you leave the tag part out (e.g. _docker tag myrepo:1.0 myrepo), Docker will automatically give it the tag latest. You probably knew all this already, but it's important to realise that this is about as far as it goes -- the latest tag doesn't have any magical powers.

How do I push a Docker image to a public repository?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).

What does latest tag mean Docker?

The latest tag is applied to the most recent docker build or docker tag command that was run without a tag value explicitly set. Therefore, it's possible to run docker commands out of order or to explicitly set tags on some images. Both scenarios cause the latest tag to refer to a build that isn't the most recent.

How do I tag a Docker image as latest?

Latest is Just a Tag It's just the tag which is applied to an image by default which does not have a tag. Those two commands will both result in a new image being created and tagged as :latest: # those two are the same: $ docker build -t company/image_name . $ docker build -t company/image_name:latest .


1 Answers

The latest is just the default value of the tag if none is specified. If you push a tagged image it does not replace the current image tagged with latest.

like image 74
Usman Ismail Avatar answered Oct 12 '22 11:10

Usman Ismail