1

I've created private local Docker registry using manual https://hackernoon.com/create-a-private-local-docker-registry-5c79ce912620 and pushed two versions of custom image to it. Then I deleted cached images and tried to pull image from local registry. Problem is that when I pull latest version it pulls version 0.1 instead of 0.2.

Here is docker images output:

REPOSITORY                                     TAG                 IMAGE ID            CREATED             SIZE
192.168.3.51:5000/ubuntu-avigdor-build-image   0.2                 2a11312a4409        12 minutes ago      1.2GB
192.168.3.51:5000/ubuntu-avigdor-build-image   0.1                 6c7519e8b4c9        6 days ago          990MB
192.168.3.51:5000/ubuntu-avigdor-build-image   latest              6c7519e8b4c9        6 days ago          990MB

As you can see, image with tag latest has image ID equal to image with tag 0.1. It is not what I want.

How could I make Docker pull image 0.2 version when I ask for latest? Have I missed something when I pushed and tagged images?

1 Answers1

3

The "latest" is just another tag, which should really be called "default", but it's too late to change that. The tag can point to anything, it's not necessarily the most recent release. You may decide to point it to the most recent stable release. Some avoid having any latest tag, forcing people to select a major version number they want to use, which helps if you are doing semver.

You control the value of the latest tag by pushing an image manifest with that tag:

docker pull 192.168.3.51:5000/ubuntu-avigdor-build-image:0.2
docker tag  192.168.3.51:5000/ubuntu-avigdor-build-image:0.2 \
            192.168.3.51:5000/ubuntu-avigdor-build-image:latest
docker push 192.168.3.51:5000/ubuntu-avigdor-build-image:latest
BMitch
  • 5,966
  • 1
  • 25
  • 32