Last active
October 12, 2021 10:01
-
-
Save remlapmot/131895906d471684d37548b8a61f5563 to your computer and use it in GitHub Desktop.
Shrink WSL2 virtual disks and Docker images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ensure hyper v installed | |
# DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V | |
# https://www.hanselman.com/blog/shrink-your-wsl2-virtual-disks-and-docker-images-and-reclaim-disk-space | |
cd $env:LOCALAPPDATA\Docker\wsl\data | |
optimize-vhd -Path .\ext4.vhdx -Mode full | |
# optional | |
# start docker | |
Start-Process -FilePath "C:\Program Files\Docker\Docker\Docker Desktop.exe" | |
Start-Sleep -s 45 | |
docker system prune # -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment