简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM