Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vm.max_map_count problem for docker at windows

Tags:

docker

windows

I am trying to run ELK docker images on my windows10 as below.

  C:\WINDOWS\system32> docker run  -p 5601:5601 -p 9200:9200 -p 9300:9300 -p 5044:5044  -p 9600:9600 -p 9700:9700 -it --memory="3g" --name elk sebp/elk

I got below error, could i set vm.max_map_count at docker run command line?

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Any suggestion or hints are more than welcome!

like image 617
stewchicken Avatar asked May 10 '26 07:05

stewchicken


2 Answers

This can be done via WSL's support of a .wslconfig file (stored in your Windows %userprofile% folder), which can apply and persist such setting across restarts, for example:

[wsl2]
kernelCommandLine = sysctl.vm.max_map_count=262144

(Note that's NOT a space after sysctl, but a period, which is necessary for it to work, from my testing.)

After saving the file, restart wsl with wsl --shutdown. Before reopening your WSL, make sure the vm is shutdown, using wsl -l -v, as it can take several seconds sometimes.

For more on this file, its many available settings, and even that need to wait for the shutdown, see the docs.

like image 98
charlie arehart Avatar answered May 16 '26 13:05

charlie arehart


I've had similar experience with running elastic/elastic, so this might help.

When you're running it in WSL2, you might want to log in to your WSL VM: wsl -d docker-desktop (Where docker-desktop is the name of the vm, you can check for them with wsl --list

Once in your docker-desktop, do the following:

echo "vm.max_map_count = 262144"> /etc/sysctl.d/999-docker-desktop-conf

followed by: sysctl -w vm.max_map_count=262144

You can then exit the docker-host by typing exit.

like image 43
Mercatres Avatar answered May 16 '26 14:05

Mercatres