What is the best Docker labeling strategy?

There is no doubt that the "last" tag is not enough (i.e. if you want a rollback / debugging).

What is the best practice for docker manipulation? Is it better to tag it with an assembly number or a commit number? Or some other option?

+5
source share
1 answer

We do not use tagging for the development environment, because we have pretty good coverage for testing, but I suggest that you can easily mark the container with your CI tool assembly number (Teamcity, Jenkins), something like

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

However, the deployment of production is a slightly different story. For this we use two tags: previous and last

1.Build build container on build server

2.Push it for a common repo

3. Go to the production server.

The last tag is always contained in a common repository. Before step 3, simply repeat the tag of the existing current container previous .

What is the use?

If you have your last container with a critical failure, you simply roll back to the previous one . This is an extremely rare case when you need to perform a quick rollback, say, 4 deployments, so there is no need to maintain versions there

+3
source

Source: https://habr.com/ru/post/1233957/


All Articles