I’ve been using Docker on my Desktop (yes, an actual Desktop) for a few years now. The docker_data disk had grown to a ridiculous 342GB!

And I wouldn’t have found out without this awesome tool, TreeSize. They have a free edition that I used. TreeSize then pointed me to the whopping >300Gig file - C:\Users\yours-truly\AppData\Local\Docker\wsl\disk\docker_data.vhdk

I had to do a little searching (soul and the Internet) to figure out how to get it down.

These are what I tried and didn’t work (I don’t know why they didn’t work)

system prune followed by compact virtual disk

I did a system prune with docker system prune, followed by Shutting down Docker Desktop and then ran diskpart to compact the virtual disk. That didn’t work.

image prune followed by compact virtual disk

I did an image prune next with docker image prune, followed by Shutting down Docker Desktop and then ran diskpart to compact the virtual disk. That didn’t work either.

Docker Desktop - The confusing winner

Docker Desktop then helped. I went in to the images section, and manually selected all and deleted, followed by all the unused volumes, then the build history. And in the status bar (and this is key), I saw how much disk it was using. The usage kept going down with each iteration of deletes, all the way from 342 Gigs to 34 Gigs (yes, that much 🤯).

Once that was done, I then went into Powershell, and ran diskpart.

In diskpart’s shell, I entered these commands

select vdisk file="C:\Users\sudip\AppData\Local\Docker\wsl\disk\docker_data.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk

Now, the VHDK disk size actually went down. What lesson did I learn from my failures? None. docker system prune shouldda done the same thing I did from Docker Desktop. But hopefully, this will help someone who’s facing the same problem.