简体   繁体   English

私有 docker 注册表中的自动最新标签

[英]Automatic Latest tag in private docker registry

I setup my own docker registry using this image: https://hub.docker.com/_/registry我使用此图像设置了我自己的 docker 注册表: 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.将图像推送到 dockerHub 时,它会自动分配最新标签,因此您始终可以使用该标签访问最新图像。

That does not seem to be the default behaviour for a self-hosted docker registry.这似乎不是自托管 docker 注册表的默认行为。 Is there any way to configure it so I get a latest-tag automatically?有什么方法可以配置它,以便我自动获得最新标签?

Even though Docker Hub behaves in that way, pushing latest tag automatically is not the default behavior for a Docker registry.尽管 Docker Hub 以这种方式运行,但自动推送latest标签并不是 Docker 注册表的默认行为。

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.通常,除了您要推送的标签之外,推送latest的操作是自定义逻辑,它是为您的应用程序设置的 CI 流程的一部分。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM