简体   繁体   English

如何在Docker注册表中获取最新的滚动标签

[英]How to get a rolling latest tag in the docker registry

I'm trying to understand the docker registry and it's tagging. 我正在尝试了解Docker注册表及其标记。

I'm actually using the gitlab registry. 我实际上正在使用gitlab注册表。

Scenario: 场景:

I push image1:latest 我推送image1:latest

Five minutes later I push image1:latest again. 五分钟后,我再次按下image1:latest

I only have one instance of image1:latest in my registry. 我的注册表中只有image1:latest一个实例。

I'm guessing that a tag is just text with no semantic meaning which is understood. 我猜测标签只是文本,没有可以理解的语义。 So the registry cannot keep only one image with the latest tag. 因此,注册表不能仅保留一个带有latest标记的图像。 It'd doesn't understand that latest means something. 它不明白latest意味着什么。

What I need, if I am understanding this correctly, is a way to only have one image with the latest tag. 如果我正确理解这一点,我需要的是一种仅使用latest标签的图像的方法。 So in my example above, I would see.. 因此,在上面的示例中,我将看到..

image1 - Uploaded 5 minutes ago

image1:latest - Uploaded 30 seconds ago

If it doesn't work this way then what is the correct versioning strategy for containers? 如果这种方式不起作用,那么容器的正确版本控制策略是什么?

This article on medium will help clear up a lot of confusion. 这篇关于媒介的文章将帮助您消除许多困惑。

https://medium.com/@mccode/the-misunderstood-docker-tag-latest-af3babfd6375 https://medium.com/@mccode/the-misunderstood-docker-tag-latest-af3babfd6375

In my case, we typically version the number of our image builds, for example, tagging the image with image1:v_1, will create an image image1:v_1. 就我而言,我们通常会对映像构建号进行版本控制,例如,使用image1:v_1标记映像将创建映像image1:v_1。 What also happens is that image1:v_1 can also be referenced using image1:latest. 同样发生的是image1:v_1也可以使用image1:latest进行引用。 So if you keep tagging image1 with image1:latest it doesn't really have a tag, it just knows that it's the latest. 因此,如果继续使用image1:latest标记image1,它实际上并没有标记,它只会知道它是最新的。 Hope that wasn't too confusing. 希望不要太困惑。

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

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