Configuring Docker for Elasticsearch

For correctly deploying Elasticsearch, configuration of Docker must be tuned. Please refer to Elasticsearch's official guide.

On Ubuntu, take the following steps:

  • set the vm_map_max_count setting in /etc/sysctl.conf by adding the following line:

    vm.max_map_count=262144
    
  • set user limits in /lib/systemd/system/docker.service (also see sample configuration file):

    LimitNOFILE=1048576
    LimitNPROC=infinity
    LimitCORE=infinity
    LimitMEMLOCK=infinity
    

    N.B.: this way the limits are set for the Docker daemon. To reduce memory overhead, they should be set per container (refer to the guide), but this requires running the container in privileged mode, which is a known issue when deploying services to a Swarm.

  • restart the Docker daemon:

    sudo service docker restart