问题描述
在Docker Hub上指定自动构建时,可以设置一些设置( Type
('Branch'或'Tag'), Name
, Dockerfile位置
和 Docker标签名称
)。但是不幸的是,我没有找到任何文件。
When specifying an Automated Build on Docker Hub, I can set some settings (Type
('Branch' or 'Tag'), Name
, Dockerfile Location
and Docker Tag Name
). But unfortunately I didn't find any documentation for those.
我假设当我选择 Type
'Branch '并输入一个名称
,这是我使用的GitHub / BitBucket上的git仓库的分支,而 Docker Tag Name
将结果标记分配给创建的图像。
I assume, that when I choose Type
'Branch' and enter a Name
, this is the branch from my git repository on GitHub/BitBucket being used and that Docker Tag Name
results in the tag being assigned to the created image.
我玩了一下,发现了一些不清楚的东西 - 但是我希望你能向我解释。
I played around a bit with it and found some things that are not clear to me - but I hope you can explain to me.
-
添加多个条目只会分配一个标签。第一个使用'Branch','master'和'/'和'最新'作为
Docker Tag Name
,第二个是'v1'。但是只有'v1'用作标签。
adding more than one entry results in only one tag being assigned. I used 'Branch', 'master' and '/' and 'latest' as the
Docker Tag Name
in the first one, 'v1' in the second one. But only 'v1' is used as a tag.
使用键入
'Tag'导致不同的结果。我以为这可能只有在git提交被这个值标记的时候才能构建一个图像。这是什么类型的?
Using Type
'Tag' didn't result in different result. I thought this might only build an image if a git commit is tagged with this value. What is this type for?
我正在寻找将标签最新分配给最新版本的功能并使用像v1,v2,v3等一样的方案来构建旧版本,就像在本地构建图像时可以做的那样。
I was looking for the ability to assign the tag 'latest' to the latest build and use a scheme like v1, v2, v3 and so on for older builds as I could do when building images locally.
推荐答案
这是非常简单的2步...
This is VERY EASY in 2 STEPS ...
步骤1 - 点击自动构建链接
STEP 1 - Click the Automated Build link
步骤2 - 添加多个自动化构建点击BLUE PLUS BUTTON(见下图),相同的docker repo(大多数人不知道你可以添加多个自动构建)
STEP 2 - Add multiple automated builds to the same docker repo (most people do not know you can add multiple automated builds) by clicking the BLUE PLUS BUTTON (see image below)
在上图中的示例中我是...
In the example in the image above I am ...
- 添加一个映射到github主分支的最新码头标签
- 添加 0.1.0码头标签,映射到git hub 0.1.0标签
请注意,github标签必须存在!
当我点击保存并触发build 2 builds开始,一个用于最新的标签,一个用于0.1.0标签。
NOW when I click save and trigger build 2 builds are started, one for the latest tag and one for the 0.1.0 tag.
简单,当你知道如何:)想到我会提供一个完整的答案,因为这是一个很差的文件。
Simple when you know how :) Thought I'd provide a full answer here since this is poorly documented.
这篇关于Docker Hub自动构建 - 标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!