Sobes.tech
Senior

How to ensure that the correct version is deployed if the image tag does not change?

sobes.tech AI

Answer from AI

If the image tag does not change, to ensure that the correct version is deployed, you can:

  • Check the image digest, which is unique for each build. For example, in Docker, this is the sha256 hash, which can be obtained via docker images --digests.
  • In the application logs or container metadata, you can output the version or commit hash embedded in the build.
  • Use labels or environment variables inside the container that indicate the version.

Example of checking digest in Kubernetes:

kubectl get pod <pod-name> -o jsonpath='{.spec.containers[0].image}'

Then compare the digest with the expected one.

Thus, even with an unchanged tag, you can accurately determine which image version is running.

How to ensure that the correct version is deployed if… - sobes.tech