[The article is also valid for Rancher Desktop]

I'm playing a lot with Docker, but on my local computer, I usually do not pay a lot of attention to disk consumption (thank you, my Very Large SSD). But when you are dealing with big images like ABAP Platform 1909 (around 60GB), after a few docker commit and docker save warning lights started to blink in my head when I was looking at the radically decreased free space...

Normally, when the disk is getting full (or from time to time), you run docker <object> prune and voila, some disk space is back.

At least it should, but that was not the case with my Docker with WSL2 integration. I had copies of my ABAP Platform image and about 20 other, unused images. After removing them, I was expecting about 70GB of free space, which was also clearly stated after running docker images prune -a. Surprisingly, the difference on the disk was... 3GB 😕.

Luckily, there is a thread about this issue. I checked the size of my Docker vhdx file - 250GB. This number was really suspicious. I would not expect that even the ABAP Platform container could generate so many data or layers.

I work on Windows Home, so I could not use Optimize-VHD cmdlet. But the solution described with diskpart worked well (IMPORTANT! Some people in the thread say that the method described corrupted their vhdx file).

The path to the file for Docker Desktop is <user>\AppData\Local\Docker\wsl\data\ext4.vhdx. For Rancher Desktop it is <user>\AppData\Local\rancher-desktop\distro\ext4.vhdx

After all I reclaimed ~138GB and all is working good 👌.

PS. docker system df will show you the whole Docker disk usage.