On Windows 11, my docker desktop increasingly uses more disk every time I run docker-compose up. I tracked it to the size of the following file which is currently at about 100GB.
%USERPROFILE%\AppData\Local\Docker\wsl\data\ext4.vhdx
It seems on Windows you'd need to configure the Docker resource usage through .wslconfig; however, I don't see a key on the docs to adjust max disk usage.
I stumbled upon the same issue today! In my case the ext4.vhdx had grown to 265GB.
When I attempted to continue using docker-compose, I recieve the following error message:
failed to copy files: copy file range failed: no space left on device
According to this page: https://learn.microsoft.com/en-us/windows/wsl/disk-space the maxium amount of disk space should by default be either 256GB, 512GB or 1TB, depending on WSL version. So I was a little bit confused that there was no more space left on the device, especially since I had almost 500GB free space left on the disk.
Instead of using diskpart I choose to Resize-VHD which I though would be easier, instead of messing around with diskpart.
cd $env:USERPROFILE\AppData\Local\Docker\wsl\dataresize-vhd -Path .\ext4.vhdx -SizeBytes 300GB, after that I was able to continue building with docker-compose!With the command above, it is possible to limit the max disk usage for Docker when using WSL2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With