Docker Desktop takes most of the machine's RAM and then freezes or crashes
Your error
vmmem.exe uses most of the RAM in Task Manager while Docker Desktop runs2 more lines it can showFix it fast
Most common cause, 1 of 3WSL is older than Docker Desktop's minimum (Windows, WSL 2 backend)
Update WSL, shut the WSL 2 VM down so the new version loads, then start Docker Desktop again.
wsl --update
wsl --shutdownShort answer
When vmmem.exe or the Docker Desktop VM eats most of the RAM until the machine freezes, the Linux VM has no cap that suits the machine: by default it may use half of host memory. Update WSL to 2.1.5 or later, cap the VM in .wslconfig or Settings > Resources, and limit heavy containers (Docker Desktop 4.x).
Which cause do you have?
Check the three layers from the outside in: the WSL version on Windows, the memory the Docker VM was given, and how much of it each container holds. Total Memory in docker info is the VM's size, not the host's.
wsl --version
docker info | grep "Total Memory"
docker stats --no-streamThen find the line you see in this list and open its fix:
- 1WSL is older than Docker Desktop's minimum (Windows, WSL 2 backend)
wsl --version prints a WSL version below 2.1.5, or the command is not recognized, which means the old inbox WSL - 2The Docker VM has no memory cap that fits the machine
docker info reports a Total Memory close to half of the host's RAM or more, and no .wslconfig file exists (WSL 2) or the Memory limit was never changed (macOS, Linux, Hyper-V) - 3Containers run without memory limits and fill the VM
docker stats shows one container's MEM USAGE close to its LIMIT, and that LIMIT equals the VM's Total Memory, so no limit was set
What does the error look like?
vmmem.exe uses most of the RAM in Task Manager while Docker Desktop runsWindows or macOS slows to a crawl once a few containers are up, then Docker Desktop stops respondingdocker stats shows one container using almost all of the memory the VM has
Cause 1 of 3
WSL is older than Docker Desktop's minimum (Windows, WSL 2 backend)
You seewsl --version prints a WSL version below 2.1.5, or the command is not recognized, which means the old inbox WSL
Check
On Windows, vmmem.exe consuming all memory is one of the problems Docker lists for outdated WSL releases, next to hangs and GPU failures. Docker Desktop needs WSL 2.1.5 at a minimum and expects the latest release, so an old WSL alone can explain the memory use.
wsl --version
wsl --statusFix
Update WSL, shut the WSL 2 VM down so the new version loads, then start Docker Desktop again.
wsl --update
wsl --shutdownVerify
wsl --version now reports 2.1.5 or newer, and memory settles once Docker Desktop is back up.
wsl --versionConfirmed by docs.docker.com
Cause 2 of 3
The Docker VM has no memory cap that fits the machine
You seedocker info reports a Total Memory close to half of the host's RAM or more, and no .wslconfig file exists (WSL 2) or the Memory limit was never changed (macOS, Linux, Hyper-V)
Check
Docker Desktop runs containers inside one Linux VM, and that VM is sized generously by default. With the WSL 2 backend Docker Desktop leaves the limits to the WSL 2 utility VM, which takes up to 50% of Windows memory plus swap of 25% of Windows memory unless .wslconfig says otherwise. On macOS, Linux and the Hyper-V backend, the Memory limit under Resources also starts at 50% of host memory.
docker info | grep "Total Memory"
Get-Content "$env:USERPROFILE\.wslconfig"Fix
Cap the VM. For WSL 2, write the limits into %UserProfile%\.wslconfig and restart WSL; for the other backends, lower Settings > Resources > Advanced > Memory limit and apply.
# %UserProfile%\.wslconfig
[wsl2]
memory=6GB
swap=2GB
wsl --shutdownVerify
After Docker Desktop restarts, docker info shows the new, smaller Total Memory.
docker info | grep "Total Memory"Confirmed by learn.microsoft.com
Cause 3 of 3
Containers run without memory limits and fill the VM
You seedocker stats shows one container's MEM USAGE close to its LIMIT, and that LIMIT equals the VM's Total Memory, so no limit was set
Check
A container has no resource constraints unless you add them, so one leaking app or a database with a large cache can take the whole VM. When the VM runs out, the kernel starts killing processes to free memory; Docker lowers the daemon's own OOM priority, so a container is the more likely victim.
docker stats --no-stream --format "table {{.Name}}\t{{.MemUsage}}\t{{.MemPerc}}"Fix
Give the heavy services a memory limit sized for their real working set, on the command line or in compose.yaml.
docker run -d --name api -m 1g my-api
# compose.yaml
services:
api:
image: my-api
deploy:
resources:
limits:
memory: 1GVerify
The LIMIT column for that container now shows the cap instead of the VM's total.
docker stats --no-stream apiConfirmed by docs.docker.com
How do I stop it coming back?
- Write a .wslconfig with a memory cap when a Windows machine is first set up for Docker, and run wsl --update at the same time.
- Keep memory limits for every long-running service in compose.yaml, so a leak stops at its own limit.
- Leave Resource Saver on (macOS, Linux, Hyper-V backend): it turns the VM off while no containers run and hands the memory back.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, Dispatch Pro.