Tagging Docker images for fun and profit

栏目: IT技术 · 发布时间: 4年前

We :heart: Docker. It’s enabled us to have more confidence that our dev environments match production and has made deployments a breeze. Something that I’ve struggled with is effectively naming the images I generate. I’ve struggled to find consensus online about how this should be done, so have come up with something that I’ve not really seen around.

First, the problem: in some environments there’s a sensibly versioned artifact that’s pretty easy to name. For instance, packaging up an OS or a major release of publicly distributed software. In these scenarios, we’re burdened with versioning anyway so figuring out a slick system isn’t as important.

We don’t release binaries for sale, and generally operate software as a service. I don’t really want to have to enforce manual versioning through code review and the tech stack we’re using doesn’t have a slick way to verify that our versioning is correct. Most automated versioning I’ve seen just increments the PATCH version even if a contract is completely violated.

That’s why we decided to start versioning artifacts with the first eight chars from the git commit SHA. This worked great! If we see a bug in prod, we can quickly figure out what version is currently running and check it out locally. Unfortunately, it doesn’t give a quick view into order when looking at a docker registry. That’s why we’ve made an addition to this format – the date.

We now name our continuously deployed docker images (built then deployed to staging/prod in a single pipeline) like so $IMAGE_NAME:YYYY-MM-DD-$SHA . While this doesn’t give us great granularity in terms of order of changes within a single day, we’ve found it to be a happy medium. I guess an alternative on a larger team might be to use an incrementing count, but that’s harder to manage than ‘what day is today?’

We like to build our docker images early in our pipeline to use in the integration tests (a topic for a later post), so this make it pretty easy for subsequent pipeline stages to figure out what image it should run for the next test, without having to carry over artifacts from the previous stage in a stateful way.

That’s it for now, I’ll write more on this topic again I’m sure.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Introduction to Graph Theory

Introduction to Graph Theory

Douglas B. West / Prentice Hall / 2000-9-1 / USD 140.00

For undergraduate or graduate courses in Graph Theory in departments of mathematics or computer science. This text offers a comprehensive and coherent introduction to the fundamental topics of graph ......一起来看看 《Introduction to Graph Theory》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

随机密码生成器
随机密码生成器

多种字符组合密码