Interview Prep/Docker/Multi-stage builds, cache, tags and registries

How would you rollback a bad image deployed via Docker Compose on one host?

BeginnerScenarioMulti-stage builds, cache, tags and registries
Answer

Situation read → Compose has no built-in rollback.

What I'd do →

  1. Edit the image: to the previous known-good tag or digest.
  2. docker compose pull && docker compose up -d --no-deps web.
  3. Confirm with docker compose ps and docker compose logs -f web.

Why → Works only because old tags are retained, which is why we never overwrite tags.

Interview tip → For zero downtime and automatic rollback move to Swarm or Kubernetes.

All Docker questions Roadmap: Docker & containers

More on Multi-stage builds, cache, tags and registries