← Back to all fixes

Need to rollback but no previous version available

The Issue

Production deploy broke. You try to rollback but the previous image was tagged `latest` and is gone.

Root Cause

Using mutable tags like `latest` means every push overwrites the previous image. You cannot go back.

How to Fix
  1. Always tag images with immutable identifiers: git commit SHA (`myapp:abc1234`) or semver (`myapp:1.4.2`)
  2. Keep at least the last 5 image versions in your registry
  3. Store the deployed image tag in your CD pipeline output or deployment record
  4. Rollback command: `kubectl set image deployment/myapp myapp=myapp:abc1233` (previous SHA)
  5. Automate rollback: if smoke test fails post-deploy, re-deploy the previous tag automatically