Docker Hub Automated Build - Tagging

2019-02-02 02:34发布

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.

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.

  • 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.

  • 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?

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.

7条回答
唯我独甜
2楼-- · 2019-02-02 03:35

For the new Docker Hub Automated Build Anton Drukh's excellent answer can be achieved with a single rule

Source Type: Tag Source: /^v([0-9.]).([0-9.]).([0-9.])$/ Docker Tag: release-{\1},release-{\1}.{\2},release-{\1}.{\2}.{\3},latest

Note that this is slightly different from Anton's answer as I am building latest from tag rather than master commit.

查看更多
登录 后发表回答