How can I accurately reclaim disk space used by Docker?

August 2, 2026 3 answers
Asked by half-inch-plywood
I'm new to Docker and have been using Zimit to archive websites for offline reading. I ran the process about five times while adjusting its settings, and eventually produced the archive I wanted. During those runs, Docker's storage grew to around 50 GB. I assumed this was temporary data, but running a prune command only removed about 20 MB. I eventually used Docker Desktop's Troubleshoot reset option and reinstalled Zimit, but I'd like to understand what created the extra storage and how to clean it up safely next time without resetting everything.

Answers

..midsentence
It would be worth checking what is actually consuming the space before deleting anything. Commands such as `docker system df` can show image, container, volume, and build-cache usage. Also check the size of the Zimit images and any named volumes, since repeated runs may leave data in volumes or build caches that a basic prune command does not remove.
Reply to this answer
6 volleyball drills
You can try `docker system prune -a -f`, which removes unused containers, networks, images, and build cache. Be careful with `-a`: it can delete images that arenโ€™t currently used by a container, so make sure you donโ€™t need them. For one-off containers, running them with `--rm` also removes the container automatically when it exits.
Reply to this answer
kettle drum
If youโ€™re using Docker Desktop with the WSL2 backend on Windows, the large file may be the WSL virtual disk rather than ordinary Docker files. WSLโ€™s virtual disk expands as Docker needs more space, but it usually doesnโ€™t shrink automatically after pruning. In that case, Docker cleanup and WSL virtual-disk compaction are separate steps; resetting Docker Desktop works because it recreates the storage, but itโ€™s a much more drastic option.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions