- Hands-On Kubernetes on Windows
- Piotr Tylenda
- 365字
- 2021-06-24 16:54:06
Semantic versioning
In order to efficiently manage the versioning and tagging of Docker images, you can use Semantic Versioning (Semver) as a general strategy. This versioning scheme is widely adopted among image distributors and helps consumers understand how your image evolves.
Generally, Semver suggests the scheme of using three numbers – major, minor, and patch – separated with dots, <major>.<minor>.<patch>, where each number is incremented as needed. As an example, 2.1.5 means that the major version of the image is 2, the minor version is 1, and the patch version is currently 5. The meaning of these release numbers and incrementation rules are similar to what you would expect for versioning non-containerized applications:
- Major: Increment if you are introducing features that break compatibility or introduce other breaking changes.
- Minor: Increment if you are introducing features that are fully compatible with previous releases. Consumers do not need to upgrade usages of your application.
- Patch: Increment if you are publishing bug fixes or patches.
The best practices for using Semver when building/pushing Docker images can be summarized as follows:
- When building a new version of your image, always create a new patch tag (for example, 2.1.5).
- Always overwrite existing major and minor tags (for example, 2 and 2.1).
- Never overwrite patch tags. This ensures that image consumers who would like to use a specific version of your application can be sure that it does not change over time.
- Always overwrite the existing latest tag.
The following set of commands shows an example of building and tagging a new version of the applicationimage Docker image:
# New build a new version of image and push latest tag
docker build -t applicationimage:latest .
docker push applicationimage:latest
# New major tag
docker tag applicationimage:latest applicationimage:2
docker push applicationimage:2
# New minor tag
docker tag applicationimage:latest registry:2.1
docker push applicationimage:2.1
# New patch tag
docker tag applicationimage:latest applicationimage:2.1.5
docker push applicationimage:2.1.5
You may also introduce additional tags that add correlation to your build system IDs or git commit SHA-1 hash, which was used for the image build.
- DevOps:軟件架構(gòu)師行動指南
- OpenStack Cloud Computing Cookbook(Third Edition)
- 自制編譯器
- ASP.NET Core 5.0開發(fā)入門與實戰(zhàn)
- Learning C++ Functional Programming
- Scala謎題
- 實戰(zhàn)Java高并發(fā)程序設(shè)計(第3版)
- 軟件架構(gòu):Python語言實現(xiàn)
- Yocto for Raspberry Pi
- Oracle JDeveloper 11gR2 Cookbook
- Android開發(fā):從0到1 (清華開發(fā)者書庫)
- Microsoft Azure Storage Essentials
- Creating Mobile Apps with jQuery Mobile(Second Edition)
- 持續(xù)集成與持續(xù)交付實戰(zhàn):用Jenkins、Travis CI和CircleCI構(gòu)建和發(fā)布大規(guī)模高質(zhì)量軟件
- Learning Hadoop 2