简体   繁体   中英

What is the best Docker tagging strategy?

It is certain, that "latest" tag is not enough (ie 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

I would say go with an older one cause they might look more stable. But you can refer to this: https://hub.docker.com/_/node/tags

To get an idea of which one is suitable for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM