Scan free
Developer disk space

Reclaim Docker & WSL disk space on Windows — without breaking anything

You deleted the images. You ran docker system prune. Free space didn't budge. That's because Docker Desktop and WSL2 keep everything inside a virtual disk file (ext4.vhdx / docker_data.vhdx) that grows but never shrinks on its own. Reclaiming the space is a two-step job — and deleting the vhdx is the one thing you must not do.

Never delete the .vhdx. That file is your Docker images, volumes and your entire WSL Linux filesystem. Deleting it wipes them. You reclaim space by shrinking it, not removing it.

Step 1 — free the space inside the disk (prune)

First, actually remove unused data so there's slack to reclaim:

# remove stopped containers, unused networks, dangling images + build cache
docker system prune -af

# also drop unused named volumes (careful: deletes volume data)
docker volume prune -f

This frees space inside the virtual disk, but the .vhdx file on Windows stays the same size. That's expected — on to step 2.

Not sure what's safe to touch?

SweepDisk flags your Docker/WSL virtual disks as "reclaim by pruning — never delete," so you clear caches confidently and leave the vhdx alone.

Download free

Step 2 — compact the virtual disk (reclaim it on Windows)

Shut WSL down, then compact the vhdx so Windows gets the freed space back.

The easy way — Optimize-VHD (Hyper-V)

wsl --shutdown
Optimize-VHD -Path "$env:LOCALAPPDATA\Docker\wsl\data\ext4.vhdx" -Mode Full

Optimize-VHD ships with the Hyper-V PowerShell module. The exact path varies by Docker version and WSL distro — for a distro it's usually under %LOCALAPPDATA%\Packages\<distro>\LocalState\.

No Hyper-V? Use diskpart

wsl --shutdown
diskpart
# in diskpart:
select vdisk file="C:\Users\you\AppData\Local\Docker\wsl\data\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit

Both do the same thing: return the empty space inside the vhdx to your C: drive. It's safe — you're compacting, not deleting.

Keep it from ballooning again

See what Docker, WSL and your caches are really using

Free categorized scan for Windows 10 & 11. Virtual disks are flagged, never auto-deleted.

Download SweepDisk