I'm looking for some guidance on best practices for container image versioning and despite reading a number of the best practice guides they leave some ambiguity.
I understand that most container images use Stable versioning and that the version tag will stay the same when things like frameworks, packages, libraries, etc are updated, but I'm unclear how this strategy ensures that the containers deployed from an image are consistent.
If I build an image today with the tag set to v1.0.0
and then next month the image is updated to include updates to frameworks, packages, libraries, etc but the application remains unchanged then my understanding of the stable versioning strategy means the new image will keep the tag set to v1.0.0
.
With this strategy how do I ensure the same version of the image is deployed consistently? Developers, test environments, and production could all believe they are using the same version of the image as the tag is still set to v1.0.0
but changes in underlying frameworks, packages, and libraries could introduce instability which everyone is unaware of between environments. Presumably this would be even worse if there is a cluster running multiple container instances of a image.
One other dimension is that the frameworks, packages and libraries might be in a parent image and with no changes in the application image itself.
Whilst I could include a build number in the tag for the application images and any parent images that contain the frameworks, packages and libraries, this feels like a huge maintenance overhead as I'd need to create a new dockerfile for the application image every time the parent image is updated due to the parent image tag now including a build number e.g. from parent-image:v1.0.0-build123
.
Is there a better strategy to solve this problem, or is it simply better to accept that there will be some differences between images using the same stable version tag? I'm not using Kubernetes at the moment but its something that we're likely to use in the future and I'm keen to pick a versioning strategy that will work for Kubernetes and ensure that there aren't "hidden" differences in the container instances deployed on the nodes from the same image version.