· Jul 15, 2021 1m read

Docker Desktop Windows - disk space consumption

I run most of my reviews using Docker Desktop on Windows 10.
According to the recommendations, I clean up docker and downloaded repositories after tests: 
Repos are simple but Docker is somewhat resistant to release the consumed disk space.The steps I executed initially:

  • remove pending containers  docker rm -f -<container> . . .
  • delete downloaded images   docker rmi <image>  . . .
  • clean caches and networks  docker system prune

But my consumed disk space didn't shrink.

So using Google I found a useful method to shrink Docker's disk consumption.
I would l like to share this experience with you.
I skip all the well explained details that you may see here 
The reason behind this unfriendly behavior:
- Docker creates a virtual hard disk ext4,vhdx
- this disk image is growing and growing automatically as needed
  but it never shrinks.
( I didn't talk about IRISTEMP od CacheTemp wink)   

My result after facts:  ~15 GB of storage returned !!
A significant amount on my 128GB SSD  Notebook

The condensed action:

  • From Docker Icon on taskbar: 
    • Docker quit 
  • From Windows CMD line. :
    • WSL --stop 
  • From PowerShell with Administrator rights:
    • Optimize-VHD -Path c:\Users\<your_username>\AppData\Local\Docker\wsl\data\ext4.vhdx -Mode Full  
Discussion (2)1
Log in or sign up to continue