Start with Docker’s own inventory
Docker manages its data through the engine. Use engine-reported object and reclaimable sizes instead of deleting files inside Docker Desktop’s storage directly. Docker intentionally keeps unused objects until you explicitly ask to remove them.
Know the four major object types
Images
Dangling images are untagged and not referenced by a container. The broader docker image prune -a can remove every image not associated with an existing container, including images you expected to reuse.
Stopped containers
A stopped container can retain a writable layer and configuration. Removing it is different from removing the image it was created from.
Build cache
BuildKit cache can be regenerated by future builds. Removing it may reclaim substantial space, but the next build can become slower and download more data. Multiple builders can maintain separate caches.
Volumes
Volumes are the high-risk category. Docker does not remove them automatically because they may contain persistent application data. “Unused by a current container” does not mean “unimportant.”
docker system prune --volumes expands a general cleanup to unused volumes. Review volume names, labels, projects, backups, and data ownership first.A safer cleanup order
- Stop active development stacks cleanly.
- Review engine-reported disk usage and reclaimable size.
- Remove clearly obsolete stopped containers.
- Review dangling or old unused images.
- Prune build cache with a scope or retention target.
- Treat every volume as user data until proven otherwise.
SpaceLint uses Docker’s own reported inventory, separates rebuildable objects from data-risk categories, and keeps volumes protected rather than presenting all Docker storage as generic cache.