4

I setup my own docker registry using this image: https://hub.docker.com/_/registry

The first thing I noticed was that the latest tag was not automatically being set. When pushing an image to dockerHub it gets assigned automatically the latest tag so you can always access the newest image with that tag.

That does not seem to be the default behaviour for a self-hosted docker registry. Is there any way to configure it so I get a latest-tag automatically?

Juliette
  • 966
  • 16
  • 35

1 Answers1

4

Even though Docker Hub behaves in that way, pushing latest tag automatically is not the default behavior for a Docker registry.

Usually, the action of pushing latest in addition to the tag that you are pushing is a custom logic that is a part of CI process set up for you app.

This is just one of many ways to achieve this

docker build -t myregistry.com/myapp:VARIABLE_TAG -t myregistry.com/myapp:latest .
docker push myregistry.com/myapp:VARIABLE_TAG
docker push myregistry.com/myapp:latest
vkozyrev
  • 1,770
  • 13
  • 13
  • `This is just one of many ways to achieve this` but it doesn't achieve it... The question was asking if there is a way to automatically add the `latest` tag to the last pushed image. "Build it with 2 tags then push each of them" isn't an answer. Most likely the OP is already doing that or, a better way, pushing the tag then adding the `latest` to the image after as that doesn't require you to upload it twice. `part of CI process set up for you app` how do you set it up? The example you gave is doing it manually – LostOnTheLine Mar 19 '23 at 15:44