Last active
May 21, 2024 13:24
-
-
Save automata/1af2b10d1166cc1865abed899f79f0f1 to your computer and use it in GitHub Desktop.
Freeing space from Docker on Windows WSL
This file contains 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
# Freeing space from Docker on Windows WSL | |
# (No need for HyperV and optimize-vhd: works on Windows Home Edition) | |
# Make sure to keep the images you really need running on Docker, this way the following command will | |
# only delete the cached layers: | |
# On WSL: | |
docker system prune -a | |
# On PowerShell: | |
wsl --manage Ubuntu -s false | |
wsl --manage docker-desktop-data -s false | |
wsl --manage docker-desktop -s false | |
wsl --list --verbose | |
wsl --shutdown | |
diskpart | |
# On Diskpart: | |
select vdisk file="C:\Users\<YourUser>\AppData\Local\Docker\wsl\data\ext4.vhdx" | |
compact vdisk | |
detach vdisk | |
select vdisk file="C:\Users\<YourUser>\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx" | |
compact vdisk | |
detach vdisk | |
exit | |
# Back on WSL: | |
wsl --manage Ubuntu -s true | |
wsl --manage docker-desktop-data -s true | |
wsl --manage docker-desktop -s true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The secret is to also free the one in
Docker
app data, not only theUbuntu
one...