Windows users will need to install Windows subsystem for Linux (WSL). You can also find guidance from Docker on the WSL-2 backend.
- Watch: Get started with Docker containers on WSL | Microsoft Learn
- Watch: Changing the Amount of CPU and Ram (WSL)
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
.