Tagging Docker Images the Right Way
-
by cobra_admin
- 38
In our consultancy work, we often see companies tagging production images in an ad-hoc manner. Taking a look at their registry, we find a list of images like:
123456 | acmecorp/foo:latestacmecorp/foo:v1.0.0–betaacmecorp/foo:v0.3.0acmecorp/foo:v0.2.1acmecorp/foo:v0.2.0acmecorp/foo:v0.1.0 |
and so on.
There is nothing wrong with using semantic versioning for your software, but using it as the only strategy for tagging your images often results in a manual, error prone process (how do you teach your CI/CD pipeline when to upgrade your versions?)
I’m going to explain you an easy, yet robust, method for tagging your images. Spoiler alerts: use the commit hash as the image tag.
Suppose the HEAD of our Git repository has the hash ff613f07328fa6cb7b87ddf9bf575fa01b0d8e43
. We can manually build an image with this hash like so:
In our consultancy work, we often see companies tagging production images in an ad-hoc manner. Taking a look at their registry, we find a list of images like: 123456 acmecorp/foo:latestacmecorp/foo:v1.0.0–betaacmecorp/foo:v0.3.0acmecorp/foo:v0.2.1acmecorp/foo:v0.2.0acmecorp/foo:v0.1.0 and so on. There is nothing wrong with using semantic versioning for your software, but using it as the only strategy for…
In our consultancy work, we often see companies tagging production images in an ad-hoc manner. Taking a look at their registry, we find a list of images like: 123456 acmecorp/foo:latestacmecorp/foo:v1.0.0–betaacmecorp/foo:v0.3.0acmecorp/foo:v0.2.1acmecorp/foo:v0.2.0acmecorp/foo:v0.1.0 and so on. There is nothing wrong with using semantic versioning for your software, but using it as the only strategy for…