4

The solution for the error: "max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]" for docker-windows wsl2 is to type the commands:

wsl -d docker-desktop

sysctl -w vm.max_map_count=262144

The problem is that i need to execute it after every system restart....

why the setting removed after every restart? is the docker-desktop container builds again each time?

how can I make it permanent?

Other similar questions regarding linux and not Docker for Desktop on Windows 10 wsl.

Omtechguy
  • 3,321
  • 7
  • 37
  • 71
  • 1
    [Elasticsearch: Max virtual memory areas vm.max\_map\_count \[65530\] is too low, increase to at least \[262144\]](https://stackoverflow.com/questions/51445846/elasticsearch-max-virtual-memory-areas-vm-max-map-count-65530-is-too-low-inc) See the first answer: `If you want to set this permanently, you need to edit /etc/sysctl.conf and set vm.max_map_count to 262144.` – jAC Mar 02 '21 at 17:17

3 Answers3

5

See the possible solutions here: Elasticsearch: Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Editing the system config (/etc/sysctl.d/99-docker-desktop.conf or /proc/sys/vm/max_map_count) won't survive a Windows system restart, it only survives Docker restart. See here.

You can however use single-node discovery type. Set this in the environment: discovery.type=single-node

docker-compose.yml

services:
  es:
    image: elasticsearch
    environment:
      - discovery.type=single-node

See also:

thisismydesign
  • 21,553
  • 9
  • 123
  • 126
  • Do you have an idea why /etc/sysctl.d/99-docker-desktop.conf not survive windows restart? that files not loading on every restart? How discovery.type=single-node can help? – Omtechguy Jul 07 '21 at 15:50
2

You can now use the flag SONAR_ES_BOOTSTRAP_CHECKS_DISABLE to disable the check. (Tried with Version 9.4.Community)

$ docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest

Astrophage
  • 1,231
  • 1
  • 12
  • 38
0

I have been having this issues recently on QNAP TS-473A NAS using Container Station. For my requirements, I need to run a ElasticSearch docker cluster using two nodes utilising docker-compose.yml file. I had to connect to QNAP NAS using SSH and ran the following command which fixed the issue:

sudo sysctl -w vm.max_map_count=262144

However, this command will only set this configuration on run time session. A restart of NAS will not survive this configuration.

To permanently change the value for the vm.max_map_count setting, update the value in /etc/sysctl.conf. But I am not able to find this file on QNAP TS-473A NAS. Because generally, we don't restart QNAP NAS very frequent, the preceding command can fix the issue on temp basis.

Permanent fix

We can run any CLI commands or scripts using autorun.sh script of a QNAP NAS. What this autorun.sh script does is, it runs any valid custom commands/scripts during NAS boot up time.

Here, you can find more details of this capability: https://www.qnap.com/en/how-to/faq/article/running-your-own-application-at-startup.

Asrar
  • 427
  • 4
  • 11