Docker Elastic Search - How to set vm.max_map_count in windows docker?

Viewed 1821

I am using elastic search in my php project and having an issue in Windows 10.

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

I fixed it by using this command but I am running it every times before I run docker-compose up -d. I don't want to run it every times. Can anyone tell me the way how I can set vm.max_map_count on windows docker container permanently?

wsl -d docker-desktop

sysctl -w vm.max_map_count=262144

1 Answers

Update:

Unfortunately not all sysctl options are allowed to be modified at runtime, see here. vm.-prefixed sysctls are not namespaced, so that leaves you only the option to modify /etc/sysctl.conf.

Original answer:

You can tune sysctl settings per container in docker-compose.yml:

version: "3.0"
services:
  myservice:
    image: myimage
    # https://docs.docker.com/compose/compose-file/compose-file-v3/#sysctls
    sysctls:
      - vm.max_map_count=262144 # won't work, see the update

Alternatively you can change this for all containers on the host by adding vm.max_map_count = 262144 line to /etc/sysctl.conf. Settings in this file are applied on boot.

Related