Tagging Docker images for fun and profit

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

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.


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

查看所有标签

猜你喜欢:

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

用户体验要素

用户体验要素

Jesse James Garrett / 范晓燕 / 机械工业出版社 / 2011-7-1 / 39.00元

《用户体验要素:以用户为中心的产品设计(原书第2版)》是AJAX之父Jesse James Garrett的经典之作。本书用简洁的语言系统化地诠释了设计、技术和商业融合是最重要的发展趋势。全书共8章,包括关于用户体验以及为什么它如此重要、认识这些要素、战略层、范围层、结构层、框架层、表现层以及要素的应用。 《用户体验要素:以用户为中心的产品设计(原书第2版)》用清晰的说明和生动的图形分析了以......一起来看看 《用户体验要素》 这本书的介绍吧!

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

在线压缩/解压 HTML 代码

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

多种字符组合密码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换