Friday, March 10, 2023

Docker limits cpu memory

Docker memory CPU limits (Windows)



for WSL2, create or open file:

%USERPROFILE%\.wslconfig

not: %HOMEPATH%\.wslconfig

Note: you have to save it in Linux LF (not Windows CRLF) mode



Add or update lines:

memory=3GB

processors=1

#kernel=C:\\temp\\myCustomKernel

#kernelCommandLine = vsyscall=emulate

swap=8GB

swapfile=C:\\temp\\wsl-swap.vhdx

pageReporting=true

#localhostforwarding=true

#nestedVirtualization=false

#debugConsole=true



src:

Microsoft Learn: example .wslconfig

src: Google search

StackOverflow: The Memory and CPU settings were removed for WSL2 integration



You have to stop all running WSL2 containers for changes to take effect.



Stop WSL2:

wsl --shutdown



No comments: