Windows 10 users will need to install WSL-2. You can also find guidance from Docker on the WSL-2 backend and a blog post from Docker on the transition to WSL-2.
Based on this guide, you can do the following to manage the memory available to WSL-2.
-
Open Windows Terminal/CMD/PowerShell.
-
Run the following command (if the notepad command doesn't work you can manually create the file.
# 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=5GB # Limits VM memory in WSL 2 up to 5GB processors=4 # Makes the WSL 2 VM use two virtual processors
-
Save the
.wslconfig
file and restart Docker.
You can see the other WSL 2 Settings available for manipulation using the .wslconfig
.