DEV Community

Eslam Basyouni
Eslam Basyouni

Posted on

How to get rid of the hidden wasted space in Docker Desktop

Everyone of us that using Docker Desktop for his containers application or for fast testing by createing a lot of containers and then remove it and same for images, and we think when delete them that we saved spaces, but the bad news that we didn't .

Docker Desktop for Windows uses WSL to manage the images and containers files and keeps them in a thin private virtual hard drive called ext4.vhdx.
we can find this file in path :

       C:\Users\Eslam\AppData\Local\Docker\wsl\data
  *** Replace my user Eslam with your user profile name ***
Enter fullscreen mode Exit fullscreen mode

This file will grow and will became big more and more , regardless if we delete all of our images and containers or not, so let's follow the below commands to shrink it.

E1

E2

E3

E4
For who is not using Windows Pro Edition and optimize-vhd command not work with him , you can try running these commands instead:

E5
******** You can Copy All of the used commands from GitHub *******
-->>[https://github.com/Eslam-Basyouni/DevOps-Tips-Tricks-Scripts]<<--

Top comments (0)