Skip to content

Instantly share code, notes, and snippets.

@xuandinhgl
Created May 8, 2021 01:48
Show Gist options
  • Save xuandinhgl/32d115d7f6b340da8f08ca22ec9e80e7 to your computer and use it in GitHub Desktop.
Save xuandinhgl/32d115d7f6b340da8f08ca22ec9e80e7 to your computer and use it in GitHub Desktop.
WSL2 Tips: Limit CPU/Memory When using Docker

Turn off all wsl instances such as docker-desktop

wsl --shutdown notepad "$env:USERPROFILE/.wslconfig"

Edit .wslconfig file with notepad and write down these settings:

[wsl2]

memory=3GB # Limits VM memory in WSL 2 up to 3GB

processors=4 # Makes the WSL 2 VM use two virtual processors

And then, from Powershell with admin rights, restart WSL2 by typing:

Restart-Service LxssManager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment