Skip to content

Instantly share code, notes, and snippets.

@edwin
Created April 14, 2022 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwin/2551029420bc5f4301ec62144a491ba7 to your computer and use it in GitHub Desktop.
Save edwin/2551029420bc5f4301ec62144a491ba7 to your computer and use it in GitHub Desktop.
Clean and Resize Docker in Windows 10

my Win10 instance have like 30GBs of file occupied by Docker Images, this is how i clean them.

First, remove the whole images docker system prune -a --filter label!=do-not-remove

Then stop Docker, and run below command from PowerShell (dont forget to run this as Administrator)

  • Mount-VHD -Path "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx" -ReadOnly
  • Optimize-VHD -Path "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx" -Mode Full
  • Dismount-VHD -Path "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment