I'm building a continuous deployment strategy using Docker. My code is hosted on Github, and the Docker registry starts an automated build when I push to git. The default setting is to start building when I push to master, and create an image with the "latest" tag. This is fine, but I want to also be able to tag commits in git and create an image based on that. There seems to be some functionality for that on the Docker registry site, on the Edit Automated Build settings page I can select "tag" for type and provide a static tag name.
How can I have the Docker tag name be the same as the Git tag name?
The goal is to be able to tag specific versions so there is a version history.
Most simple solution from the command line is a nested git-rev command:
docker tag <image> <image>:$(git rev-parse --short HEAD)"
gives you e.g.
<image> = myImage >> myImage:67df348
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With