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

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).

All Docker questions Roadmap: Docker & containers

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