Docker Tagging for Instant Rollbacks

A Docker Tag is essentially an “alias” or a “pointer” to a specific Image ID. Think of it like a git branch or a file shortcut; it allows you to label a specific version of your app so you can find it later. 1. The “Safety Bookmark” Strategy

Before you pull a new update (which usually overwrites the :latest tag), manually “bookmark” your currently working image.

Command: Bash

docker tag my-app:latest my-app:confirmed-working

  Result: You now have two tags pointing to the same Image ID. When you pull a new :latest, your confirmed-working tag stays pointed at the old, stable code.

2. The Instant Rollback

If the new update fails, you don't need to download anything or check logs. You simply re-deploy using your bookmark.

Via Docker Compose: Change your image: line and restart. YAML

services:

web:
  image: my-app:confirmed-working