Skip to content

Instantly share code, notes, and snippets.

@Guiorgy
Created May 2, 2024 10:27
Show Gist options
  • Save Guiorgy/51a2d45af97581beb874bd69c14d159a to your computer and use it in GitHub Desktop.
Save Guiorgy/51a2d45af97581beb874bd69c14d159a to your computer and use it in GitHub Desktop.
A PoweShell script to reduce the size of the WSL virtual volume used by Docker Desktop
# Stop the Docker service
Stop-Service com.docker.service
# Stop the Docker processes
Stop-Process -Name "docker.exe" -Force
Stop-Process -Name "Docker Desktop.exe" -Force
# Stop WSL
wsl --shutdown
# Optimize the virtual volume (vhdx)
Optimize-VHD -Mode Full -Path $Env:LOCALAPPDATA\Docker\wsl\data\ext4.vhdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment