Install Docker Desktop WSL2 on Windows with allocated maximum size (virtual size) less then default 1TB

This thread is based on my issues with this one
As I see, there is no working way of using WSL routine procedures to export and then import docker-desktop-data distro of Docker if the real file of ext4.vhdx is about 500 GB
OK, in this case I want to install the Docker but set up a limit of a virtual size in this ext4.vhdx to 650 GB (not use the default size 1 TB) and export - import volumes manually into the Docker (not using the WSL import-export routines).
The thing is that I will use 1 TB disk and I do not want to have problems when the host system will stuck if Docker tries to write the data into the ext4.vhdx file and the host system is full. I just want to get error messages from Linux inside a WSL2 that the system is full)
I tried to create an ext4.vhdx manually with 650 GB size

PS C:\Windows\system32> (Get-VHD -Path 'c:\Work\ext4.vhdx').Size/1GB
650

I also imported it into WSL2

wsl --import docker-desktop-data 'c:\Users\user\AppData\Local\Docker\wsl\data\' .\ext4.vhdx --vhd

But Docker fails to start.

So I wonder is it possible at all?

I don’t know why, but I was able to use a workaround.
On a newly created Windows 11 Pro I have installed WSL and Docker Desktop 4.15.
And in this combination the size (virtual size) of a newly created ext4.vhdx file and appropriate /dev/sdc disk were 250 GB
Then I was able to extend both to 650 GB. Voilà!

Now I have this

lsblk | grep isocache
sdc     8:32   0   650G  0 disk /mnt/wsl/docker-desktop-data/isocache
df -h | grep isocache
/dev/sdc        639G  2.8G  608G   1% /mnt/wsl/docker-desktop-data/isocache

I’m lucky with this, but the only thing that I’m interested in is that how and why the initial size of virtual disk (size) was set to 250 GB and not 1 TB

PS after updating to the latest Docker 4.19 version all the size values remain the same. Interesting that when I tried installing 4.15 version on my local workstation with Windows 10 it has still created 1 TB virtual size. So the matter is not in Docker. Seems like it just call some WSL2 API call which creates the files based on some internal parameters that differ in Windows 11 and Windows 10

The installed WSL version is responsible.

Btw. you shared the link I quoted in the OP of the topic.

Yeah, I thought that it all depended on WSL version
But both Win 11 and Win 10 have version 2
It may depend on release but I did not find how to check it
The only thing that I found was that c:\Windows\System32\wsl.exe Filу version on Win 10 is 10.0.19041.2311 and on Win11 is10.0.22621.1
Is there a way to check the release version somehow?

By WSL version I indeed mean the version of the WSL release.
You can check the installed version using wsl --version

This does not work. The only thing that works is
wsl -l -v
And as I have already said they both have version 2. No any info about particular release can be found

Looks like you have an older version that predates the implementation of the --version argument.

With the current version it should look like this:

C:\Users\me>wsl --version
WSL-Version: 1.2.5.0
Kernelversion: 5.15.90.1
WSLg-Version: 1.0.51
MSRDC-Version: 1.2.3770
Direct3D-Version: 1.608.2-61064218
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-Version: 10.0.22621.1555

My distributions use WSL2 as well (as a matter of fact on Windows Home I can not use anything else) . As you see it is not mentioned anywhere in the output.
It is all about the release version.

Seems like there is an issue in Win 11. When I use
wsl --version
it just throws me all possible options (like help)
In Win 10 output almost the same, except the last string
Windows version: 10.0.19045.2846

Again: it is the version of the installed WSL release that is responsible for that, it is not about the Docker Desktop version, or whether WSL2 or WSL1 is used.

This is relevant version:

Note: The command and output I posted early is from Win11, and I get the same output on my two corporate Win 10 notebooks, because I use the latest WSL release version. Try wsl --update --web-download, if the command throws an error or lists the arguments, update it from the Microsoft Store app.

I hope at one point you find what you are looking for. Good luck!