Shrink your WSL2 Virtual Disks and Docker Images and Reclaim Disk Space

1 · Scott Hanselman · Oct. 5, 2021, 6:26 p.m.
Docker Desktop for Windows uses SSL to manage all your images and container files and keeps them in a private virtual hard drive (VHDX) called ext4.vhdx. It's usually in C:\Users\YOURNAME\AppData\Local\Docker\wsl\data and you can often reclaim some of the space if you've cleaned up (pruned your images, etc) with Optimize-Vhd under an administrator PowerShell shell/prompt. You'll need to stop Docker Desktop by right clicking on its tray icon and choosing Quit Docker Desktop. Once it's stopped, y...