Skip to content

Instantly share code, notes, and snippets.

@kad1r
Last active July 24, 2024 05:39
Show Gist options
  • Save kad1r/1d6dc1e6a67832656206fac6bbb13703 to your computer and use it in GitHub Desktop.
Save kad1r/1d6dc1e6a67832656206fac6bbb13703 to your computer and use it in GitHub Desktop.
Shrink docker size

Here is the original link

Go to ~\AppData\Local\Docker\wsl\data and check the file size of ext4.vhdx. Right click the file and select "Copy as path". Apply these commands on cmd.

wsl --shutdown
diskpart

New cmd will open and

select vdisk file="ext4.chdx full path here with double quotes"
compact vdisk
-- or you can use optimize-vhd command
optimize-vhd -path "\AppData\Local\Docker\wsl\data\ext4.vhdx" -mode full

That’s it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment