4
votes

Using Ubuntu 16.10 Docker 1.12.3 Docker Composer 1.8 Elastic latest tag of official elastic docker image

docker-compose.yml

version: '2'
services:
    elastic:
        image: elasticsearch
        environment:
            - ES_JAVA_OPTS=-Xmx2g -Xms2g

getting on logs

elastic_1 | ERROR: bootstrap checks failed elastic_1 | max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] elastic_1 | [2016-11-18T17:48:17,058][INFO ][o.e.n.Node ] [HK_OIan] stopping ...

Any idea, thanks

3

3 Answers

13
votes

After reading resources from elasticsearch official doc i manage to start the container updating my docker-compose.yml file by

version: '2'
services:
  elastic:
      image: elasticsearch
      environment:
          - ES_JAVA_OPTS=-Xmx2g -Xms2g
      ulimits:
          nofile:
              soft: 65536
              hard: 65536

adding the ulimit section

1
votes

Those who are using a direct docker run command instead of docker-compose can set ulimit like below.

docker run --ulimit nofile=65536:65536 -p 9200:9200 --name elastic-search docker.elastic.co/elasticsearch/elasticsearch:6.4.2
0
votes

check for the actual limit when the process is running (albeit short) with:

cat /proc/<pid>/limits

You will find lines similar to this:

Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes 
<truncated>    

Then depend on the runner or container (in my case it was supervisord's minfds value), you can lift the actual limitation configuration.