Docker Desktop eats RAM past WSL limit set in .wslconfig file

Finally, if your issue has not been addressed elsewhere, running:

  • :whale: :arrow_right: Settings :arrow_right: Diagnose & Feedback :arrow_right: Open Issues.

This forum is not an official product support or issue reporting channel.

This option does not exist…

I’m running Docker Desktop on Windows 10 Pro on 2 separate machines. 1 machine is only running a single item, the Portainer Extension. The other is running a number of containers.

I noticed when Docker Desktop is running for a time, usually more than a day, it starts to seriously start consuming RAM, to the point where it was maxing out my system’s RAM & causing memory errors. While this system was only running Portainer to manage the Portainer on the other system.

Looking for support I was directed to a post about WSL2 being the problem & IT taking a bunch of RAM, & a solution to set a limit to it’s usage with a .wslconfig file in C:\Users\#MYUSERNAME#\.wslconfig
My file is:

[ws12]
processors=1
memory=1GB
swapFile=F:\\TMP\\docker\\swap\\wsl-swap.vhdx
swap=16GB
pageReporting=true

But when I startup Docker Desktop the Vmmem usage immediately goes to 1,800MB but usually stops around 2,100 or 2,300. Which is much more than the 1GB limit that I set. Even with the file settings & multiple restarts after Docker Desktop has been running for a few days it will say in Task Manager that it’s using 6GBs but Resource Monitor will show Vmmem using as much as 18GBs. If I close Docker Desktop from the Task Tray Icon the RAM will go down to nothing. Other WSL2 entities will respect the 1GB limit, but Docker Desktop does not.

My other machine, which has been running Docker Desktop for a year or so hasn’t had such an extreme RAM problem, though I cannot say it had none as I did run into occasions where I couldn’t identify what was using it, but it never got to that point. Now I am having the same problem, I have set the .wslconfig allowing 5GBs of RAM & when closed I gain back as much as 12GBs of space, but it has yet to peg my RAM usage. It never had a very noticeable usage until after the update to Docker Desktop 4.11.1 (84025)

I have the same problem. I have .wslconfig limited to 6GB. I have a 32GB system. Without DD or WSL, it runs at about 12GB. When I start DD/WSL, system memory goes to 14 GB and then slowly grows to 31 GB !!! It grows over the weekend when I am not using the system. Selecting DD restart does not affect the memory graph. The only way I can recover the memory is to use powershell kill DD pid. System memory usage instatly goes down from 31 to 12 GB. I keep my DD updated and just updated again right now. I like developing with WSL and Docker Desktop, but this issue is a pain. I can remote desktop into my system in the morning and the lag is so great I can barely type until I once again.kill the DD pid. Using WSL-t docker-desktop abd WSL -shutdown does nothing. The other distributions (ubunto and docker-desktop-data) both terminate, but not docker-desktop. Looking a resource monitor shows the WSL VMEM with 3.1 GB.

Yeah, it’s gotten worse with the updates. For me right-clicking the Docker Desktop tray icon & Quiting Docker Desktop frees up most of it, but usually leaves around 2GB still in use, but as little as 1 & as much as the WSL limit I set. It does at times take a few minutes for it to free up. On rare occasions it does not free up at all until I shutdown WSL. that frees up everything, including what is still being used when I Quit every time, leaves my system using 5-8GB. The 5GB limit I currently have set seems to be respected by everything except Docker, but the Task Manager rarely shows it using much, it’s like Docker Desktop is taking RAM but telling the system it’s not. Within Docker Desktop it always says it’s using 3-5GB, never more
The system knows the RAM is gone, being used by something, but it’s chart of who’s using what doesn’t account for at times an extra 12GB that magically reappear when I Quit Docker Desktop or restart WSL. I feel Docker may even be taking the RAM then loosing it so the system can’t get it back, but Docker is not actually using it either.
For me personally it sometimes takes a few days before it inflates enough for it to cause a problem, then I just WSL --shutdown from the terminal (Powershell but command prompt should work as well) then reopen Ubuntu & Restart Docker Desktop.