Docker is using too much disk space on Windows
Short answer: Docker Desktop keeps everything in one virtual disk (a .vhdx file under %LocalAppData%\Docker\wsl). Old images, stopped containers and build cache pile up inside it, and the file does not shrink by itself, even after you clean up inside Docker.
By hand
- See what Docker can reclaim:
docker system df - Remove what nothing uses:
docker system prune. Add-afor unused images; use--volumesonly if you are sure, because volumes can hold databases. - Shrink the disk file so Windows gets the space back. WSL must be shut down first (
wsl --shutdown).
With Sparewise
- Shows what Docker itself says is reclaimable, with the exact prune command. It never runs a prune for you.
- Shows the build-cache limit and where to set it, so it does not fill up again.
- Can give the WSL disk space back to Windows, after asking, and closes Linux windows first.
- Never deletes volumes. That call is yours.