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 →
- Edit the
image:to the previous known-good tag or digest. docker compose pull && docker compose up -d --no-deps web.- Confirm with
docker compose psanddocker 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.
More on Multi-stage builds, cache, tags and registries
Show a multi-stage Dockerfile for a Java Spring Boot app and explain what you gain.BeginnerCI rebuilds from scratch every run and takes 12 minutes. How do you bring it down?IntermediateYou tag every build `myapp:latest`. A rollback is requested. What happens?BeginnerHow do you promote an image from dev to prod registry without rebuilding?IntermediateDisk on the build server keeps filling up with images.BeginnerWhen do you use `--no-cache` and when is it a smell?Beginner