I am using Docker on Windows with WSL 2 backend. The hard disc image file on path C:\Users\me\AppData\Local\Docker\wsl\data
is taking up 160 GB of disc space. I have tried the command:
Optimize -VHD -Path C:\Users\me\AppData\Local\Docker\wsl\data\disc.ext4 -Mode Full
but it only clears up a couple of MB.
I also tried to clean docker with docker prune
but that doesn't help either.
I also tried modifying the .wslconfig
file, but it turns out you can't set disc space usage that way, only RAM usage.
I am not sure why is it taking up so much space in the first place, considering I only have 5 containers and images. Any help/advice is highly appreciated.
Additional info:
docker image ls -a
... cumulatively shows only 2 or 3 GB taken.
docker container ls -a
... shows 5 containers.
docker info shows (I didnt copy and paste the whole output because it's too long):
Server:
Containers: 5
Running: 2
Paused: 0
Stopped: 3
Images: 5
Kernel Version: 5.4.72-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 12.37GiB