How to increase 1TB limit in docker desktop

For a long time I have had an issue where running docker desktop on a windows machine limits the disk size.

For example, the .vhdx file is located on my C: drive and on that drive there is plenty of space, but docker desktop shows me:

Disk: 528.61GB used (limit 1006.85GB)

Even though there is space, it limits me to 1TB. I looked around here for similar issues and some people have offered that in settings > resources you can change the slider to allocated more space, but for me there is no slider there, I can only browse the directory the disk file is in.

I also tried myself to change the .vhdx file size with diskpart but unfortunatly I am not a pro at that and last time I bricked the file and had to use a backup that I made for that case.

Is there a way I can change that limit?

It is a wsl2 default setting for the virtual disk of distributions.

Recent wsl2 versions come with a tool called WSL Settings, that allows changing that setting. But, it only applies to new distributions.

A short google search indicates there is a Resize-VHD cmdlet in Powershell, that can be used to change the phyiscal size of a virtual disk, see: https://learn.microsoft.com/en-us/powershell/module/hyper-v/resize-vhd?view=windowsserver2025-ps

Thank you for your response.
I am currently in the process of making backups so I cannot try yet, but I myself found on google another command where they used “Optimize-VHD”, but in my case the Resize-VHD should work fine?

Another thing I found was on here How to manage WSL disk space | Microsoft Learn where they used --manage to expand so if I also run wsl --manage docker-desktop --resize 2T then that should also do it?

Funny thing was when I ran wsl.exe --system -d docker-desktop df -h /mnt/wslg/distro then it showed me that there is a filesystem /dev/sdc with size 1007G and used 57M, this seems to be the same 1006.85 but strange how it was using only 57M.

I just want to be sure before I run because if I brick the disk then I have to go back from the backup.

I tried the Resize-VHD command, it ran fine in the commandline but after opening docker nothing changed. The limit is still 1006.85GB.

I should have thought about it: Resize-VHD only resizes the Disksize, but not neither the partition, nor the filesystem.

Apparently WSL now has a convent way to resize virtual harddisks: https://learn.microsoft.com/en-us/windows/wsl/disk-space#how-to-expand-the-size-of-your-wsl-2-virtual-hard-disk

I nicely tried that, I managed to change the virtual size to 2TB so with diskpart I saw this:

Virtual size: 2048 GB
Physical size:  536 GB

And when I tried the last part of making WSL aware of the changes, I got this reponse:

resize2fs 1.47.0 (5-Feb-2023)
resize2fs: Bad magic number in super-block while trying to open /dev/sdb
Couldn't find valid filesystem superblock.

If I would need to guess i’d say you didn’t look up with device is the one actually used by your distribution.

Please paste the output of:

lsblk | grep /mnt/wslg/distro

It does not seem to provide any output, it just started a new line. I must also mention that with wsl --list I only have docker-desktop so I am using that.

Since there is no separate docker-desktop-data distro anymore, I had my hopes on this one:

I should have left this topic to someone who actually did what you are looking for. There are too many bits and pieces that I can’t anticipate.

That would be

lsblk | grep /mnt/host/wslg/distro

but that disk is the disk of the docker-desktop WSL2 distribution. It is true that there is no “docker-desktop-data” distribution, but the disk still exists and mounted as data disk. The name of the data disk could be found this way:

lsblk | grep /mnt/docker-desktop-disk

You can also get the disk path in a container as the hosts files are bind mounted from the hostand the df command will show the real disk path

docker run --rm -it --privileged --pid host ubuntu df -h

Output

Filesystem      Size  Used Avail Use% Mounted on
overlay        1007G   12G  945G   2% /
tmpfs            64M     0   64M   0% /dev
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
/dev/sdd       1007G   12G  945G   2% /etc/hosts

That data disk can be found in the following folder on the host:

phppr@TA-LT C:\Users\phppr\AppData\Local\Docker\wsl\disk>dir
 Volume in drive C has no label.
 Volume Serial Number is B66D-90E7

 Directory of C:\Users\phppr\AppData\Local\Docker\wsl\disk

2024-12-14  19:33    <DIR>          .
2025-06-19  22:15    <DIR>          ..
2025-06-22  21:23    14,873,001,984 docker_data.vhdx
               1 File(s) 14,873,001,984 bytes
               2 Dir(s)  93,877,485,568 bytes free

The “main” folder next to “disk” contains the OS disk as ext4.vhdx but the one quoted bove is the data disk. That is the one that can be moved to a new location using the GUI (Settings » Resources » Advanced » Disk image location)