Docker Hub automatic builds are a great way to keep your Docker images
up to date with a
git repository, but building sensibly tagged releases isn’t
very straightforward. It’s easy to create ones for a tag (like
less so to create versioned images, such as:
myimage:4 myimage:4.1 myimage:4.1.1
This means that when you release a
v4.1.2, it becomes the new
It turns out that you can do this with docker automatic builds. At the time I
got this working it wasn’t well documented, but these days it has docs.
Note: This information was adapted from something I found in a Google search, but I’ve since lost the source. I’ll update here if I find it again.
To achieve this, set up your build rules as follows:
|Type||Name||Docker Tag Name|
Now, tag your versions in
git as full semver specifiers, with a
v in front,
git tag -a v4.1.2 -m 4.1.2
When your docker image is auto-built from git, it will now have tags which match the example at the beginning of this post.
Eventually I’ll write up a more thorough post on how you can perform auto-builds and releases with github, docker hub, and travis. For now you can learn a lot from this post, and by looking at the travis config for secureoperator.