KB Article #181815

Elasticsearch container start failed

Problem

Elasticsearch container start failed with that error :

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


Resolution

The following requirements and recommendations apply when running Elasticsearch in Docker in production.

Set vm.max_map_count to at least 262144edit

The vm.max_map_count kernel setting must be set to at least 262144 for production use.

How you set vm.max_map_count depends on your platform:

  • LinuxThe vm.max_map_count setting should be set permanently in /etc/sysctl.conf:
    grep vm.max_map_count /etc/sysctl.conf
    vm.max_map_count=262144
    To apply the setting on a live system, run:
    sysctl -w vm.max_map_count=262144
  • macOS with Docker for MacThe vm.max_map_count setting must be set within the xhyve virtual machine:
    1. From the command line, run:
      screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
    2. Press enter and use`sysctl` to configure vm.max_map_count:
      sysctl -w vm.max_map_count=262144
    3. To exit the screen session, type Ctrl a d.
  • Windows and macOS with Docker DesktopThe vm.max_map_count setting must be set via docker-machine:
    docker-machine ssh
    sudo sysctl -w vm.max_map_count=262144
  • Windows with Docker Desktop WSL 2 backendThe vm.max_map_count setting must be set in the docker-desktop container:
    wsl -d docker-desktop
    sysctl -w vm.max_map_count=262144
  • Windows with Docker Desktop WSL 2 backend permanent solution , create the file c:\<user>\.wslconfig with that content:
    [wsl2]
    kernelCommandLine = "sysctl.vm.max_map_count=262144"

Ref : https://www.elastic.co/guide/en/elasticsearch/refe...