docker on wsl2 very slow docker on wsl2 very slow docker docker

docker on wsl2 very slow


This comes from the "vmmem" which consumes as much resource as it can.To solve the problem just go to your user filefor 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 probably have your code stored on the Windows machine in a folder similar to this...

C:\\Users\YourName\projects\blahfu

But you are using Docker on WSL 2 which is a different (Linux) filesystem. So, when you do a Docker build all of the code/context gets copied from the Windows filesystem to Linux filesystem and then from there to the Docker container. This is what takes the most time and is incredibly slow.

Try to put your project into a folder like this...

/home/YouName/projects/blahfu

You should get quite a performance boost.


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 !