Friday, January 27, 2023

Docker Desktop limits with WSL2 on Windows

Limiting Memory Usage in WSL2 | Aleksandr Hovhannisyan

How to limit Memory usage on Docker Desktop WSL 2 mode | by Balaji Dharma | Geek Culture | Medium


edit "$env:USERPROFILE/.wslconfig"

make sure to save with LF only (unix style, no CR LF typical for Windows)
i.e. by using Notepad++ or edit from WSL

> wsl
> editor "$(wslpath "C:\Users\YourUsername\.wslconfig")"
> # or
>  vi "$(wslpath "C:\Users\YourUsername\.wslconfig")"

# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Limits VM memory, whole numbers using GB or MB
memory=4GB
# Sets the VM to use two virtual processors
processors=2

No comments: