After having read about the performance improvements when running Docker on wsl2, I have been waiting for the official release of Windows 10 that supports wsl2. I updated Wi
This comes from the "vmmem" which consumes as much resource as it can. To solve the problem just go to your user file for me in
C:\Users\userName
In this directory create a file named ".wslconfig" in which you will configure how many resources can consume WSL2:
[wsl2]
memory=900MB #Limits VM memory in WSL 2 to 900MB
processors=1 #Makes the WSL 2 VM use one virtual processors
Now close your docker and wait for "vmmem" to close in the task manager.
then You can restart docker and normally "vmmem" will not exceed the limit you have set (here 900MB) If don't work restart your computer.
I hope it helped you.
You can edit setting docker return Hyper-V. Click docker -> Setting -> Uncheck "Use the WSL 2 based engine".
Maybe you could try to disabling IPv6 in the docker daemon config.json. You can edit it via the Docker Desktop, under Settings > Docker Engine.
wsl container have they proper filesystem isolated from the windows filesystem. The base idea is to copy your source code from windows file systeme to wsl file systeme.
from window you can acces the wsl container and copy your project to a wslcontainer :
navigate with explorer to \\wsl$
rebuild the container from this location this will do the trick !
Probably you have your code on the Windoes machine like in
C:\\Users\YourName\projects\blahfu
But you're using docker on WSL 2 which is then on another filesystem. So if you do a docker build you got all the code/context copied from Windowsfilesystem to Linux filesystem and then from there to the docker container. This takes it's most of hte time and is incredibly slow.
Try to put your project into
/home/YouName/projects/blahfu
This should give quite a performance boost.
If the data for the actual docker container is stored on a windows file system (i.e. NTFS) instead of stored on a native linux filesystem (regardless of what the docker container contents are, which are likely already linux based), then I think you are going to see slow performance because you're running WSL and using the docker container from a mounted WINDOWS file system (i.e. /c/mnt/...).
If you copy your docker container to something like /usr/local, or /home//docker on WSL then you may see a 10x performance INCREASE. Try that and see if it works?