Pulling the latest image from dockerhub

Saurabh Shah picture Saurabh Shah · Jun 1, 2016 · Viewed 14.3k times · Source

Suppose there is a user repository on dockerhub which has 3 images. Images are tagged as A, B and C. Here C is my latest tag.

Now I don't know these tags. When I do a docker pull user/image, this gives me an error saying that Tag latest not found in repository docker.io/user/image. How can I pull the image with the latest tag(C in this case).

Answer

tworabbits picture tworabbits · Jun 1, 2016

Yes, I absolutely agree: the latest tag is confusing. The latest tag actually does not necessarily point to the latest version of your image. Let's have a look:

1) When you pull an image without specifying a tag name, Docker will try to pull the image tagged 'latest'

2) When you do not tag an image before your push operation to the registry, Docker will give it the 'latest' tag automatically

3) When you do tag your image and it sounds like that is what you are doing, Docker will never tag anything with 'latest'; You then have to apply the 'latest' tag manually

From my point the 'latest' tag should be a 'default' tag instead and understood as the default image that is pulled from the registry, when no tag name was specified in the pull command.

Refer to this answer for more information on how to apply multiple tags: How to create named and latest tag in Docker?