What is a dangling image and is it safe to delete?
BeginnerScenarioMulti-stage builds, cache, tags and registries
Answer
Situation read → An image with no tag, shown as <none>:<none>, usually left when a tag moved to a new build.
What I'd do →
docker images -f dangling=true
docker image prune
Why → Safe unless a running container or another image depends on it, in which case Docker refuses or keeps it as a parent layer. -a removes all unused images, not only dangling ones.
Interview tip → Distinguish dangling (untagged) from unused (no container).
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