do I need to manually tag “latest” when pushing to

2020-05-24 20:27发布

问题:

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)?

回答1:

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.