Video in progress

What is the risk of deploying a Docker image with the latest tag?

latest is just a label stuck on whatever was pushed last, not a version. With it you cannot tell which code is running, rollback gets harder, and different nodes may end up running different images.

📖 Answer

The situation: the deployment says image: shop-api:latest. Yesterday one node pulled the image, today a new push happened, then a new node was added and pulled a different latest. Now two different versions of one service are running at the same time and nobody knows.

More problems:

  • since the image tag has not changed, Kubernetes sees "no change" and does not roll out;
  • there is no such thing as "the previous latest" to go back to.

Good practice is an immutable, meaningful tag:

docker build -t registry.example.uz/shop-api:1.4.0 .
# or by git commit
docker build -t registry.example.uz/shop-api:1.4.0-3f9c2ab .

Stricter still is pinning by digest: shop-api@sha256:.... The digest is computed from the image contents, so nobody can quietly swap it out.