Docker Community Forums

Share and learn in the Docker community.

Version docker image to latest

insecure-registry
docker

(Abhaykumarsomani) #1

Hi,
I have created my private repository and pushed my docker image with the latest tag. Now, I have created version 0.2 of that image and pushed this image, but the latest tag does not change. I was expecting this newer version to become the latest. Similarly, when I push image:0.3, i would want that to be latest.

Am I missing something, or is there a particular way to achieve this, which I don’t know.
Right now, I am building my images like this:
docker build -t /sabhay/myimage:0.2 .
and then I am directly using docker push


(Nathan Le Claire) #2

I think the behavior is that latest is the default tag when you docker build, not docker push. You would have to make it explicit:

$ docker build -t sabhay/myimage:0.2 .
$ docker tag sabhay/myimage:0.2 sabhay/myimage:latest
$ docker push sabhay/myimage:latest
$ docker push sabhay/myimage:0.2

Not 100% sure but that should work.