✦ For everyone, free.

Practical knowledge for real and everyday life

Home

13.2.3.1 Previous Tag Rollback

A focused guide to Previous Tag Rollback, connecting core concepts with practical Docker and container operations.

Previous tag rollback reverts a deployment by redeploying whichever image tag was previously running before the problematic update, relying on having retained that prior tag (or knowing exactly which one it was) rather than having already overwritten or discarded it.

Performing a Rollback to a Previously Known Tag

Knowing the specific tag that was running immediately before the current, problematic deployment allows a direct, targeted rollback.

docker pull registry.example.com/myapp:v1.4.2
docker tag registry.example.com/myapp:v1.4.2 registry.example.com/myapp:production
docker push registry.example.com/myapp:production
ssh prod-server "docker compose pull && docker compose up -d"

This redeploys the exact image previously associated with the v1.4.2 tag, reverting away from whatever problematic version is currently running.

Why Retaining a Record of Previously Deployed Tags Matters

Without a clear record of exactly which tag was deployed before the current one, performing a precise rollback becomes guesswork rather than a confident, targeted action.

docker service logs mystack_app --since 24h | grep "deploying tag"

Maintaining deployment logs or a deployment history record specifically tracking which tag was active at any given time supports this kind of confident rollback.

Why Tags Should Remain Available Rather Than Being Deleted

A registry retention policy that aggressively deletes older tags risks removing the exact tag needed for a rollback — retaining recent production-relevant tags for a reasonable window supports this rollback capability.

docker pull registry.example.com/myapp:v1.4.2

This rollback only works if the tag actually still exists in the registry, rather than having already been pruned by an overly aggressive cleanup policy.

Using Kubernetes' Built-In Rollout History for This Same Purpose

Kubernetes specifically tracks deployment revision history, providing this same rollback capability without needing to separately track tags manually.

kubectl rollout undo deployment/myapp
Why Previous Tag Rollback Matters

Knowing exactly which tag was previously deployed, and ensuring that tag remains available in the registry, is what makes a quick, confident, targeted rollback possible when a newly deployed version turns out to have a problem.