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?
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
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