Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best Docker tagging strategy?

It is certain, that "latest" tag is not enough (i.e. if you want to rollback/debug).

What is the best docker tagging practice? Is it better to tag it with build number or commit number? Or some other option?

like image 395
tomdavies Avatar asked Oct 18 '15 09:10

tomdavies


1 Answers

We don't use tagging for development environment, because we have pretty nice test coverage, but I suggest, you can easily tag container with your CI tool build number (Teamcity, Jenkins), something like

docker build -t {yourserviceName}:{JENKINS BUILD NUMBER}

However, production deployments - is a little bit different story. We use two tags for that - previous and latest

1.Build production container on teh build server

2.Push it to shared repo

3.Pull to production server.

The latest tag is always contained at shared repository. Before step 3, just re-tag existing running container to previous.

What's the benefit?

If you have your latest container with critical failure, you just rollback to previous one. It's extremely rare case, when you have to do a rapid rollback, let's say, 4 deployments back, so no need to maintain versions there

like image 181
Andrew Avatar answered Nov 15 '22 22:11

Andrew