After a break of about a year, I decided to give Docker Desktop a second chance, because it used to cause memory leaks when building a container on Windows 11 (23H2 Build: 22631.2715). I updated to the latest version (Docker Desktop 4.25.1 (128006)). When starting the docker engine (integrated with WSL2 backend), it immediately consumes 3GB of memory on idle. I have set in the .wslconfig the memory usage limit to 8GB so that Docker Desktop does not slow down my computer to a crawl. Any idea why is this happening?
Docker Desktop uses VMs to run containers. Did you start a container, so the VM is already occupying the RAM? Maybe the size can be configured somewhere?
I tried it with a container running and with no containers running, Docker Desktop aggressively takes hold of any RAM it is allowed to take. The size is determined by the .wslconfig file. It does a have a feature that if there is no CPU activity related to containers, it will pause and use no RAM. Still, it is inflexible, what if I have a container that needs just a bit of RAM to run?
I see you know about the .wslconfig
, so you know that the memory is handled by WSL. I don’t know how Docker Desktop could help to release unused memory. The memory issue of WSL is an old one and I found these two issues:
- https://github.com/microsoft/WSL/issues/4166
- Vmmem does not return unused memory · Issue #10143 · microsoft/WSL · GitHub
Both are open. In the second issue the screenshot shows that the vmmem process uses about 2.5 GB memory. If you see the 3 GB used by vmmem, that is something Microsoft should fix.
I haven’t tried it on Windows. If you really see using no memory at all (by vmmem too), I don’t know how that works. It is possible that they somehow freeze the entire WSL.