Elasticstash single node via docker-compose


I'm trying to run Elasticsearch in a Docker container using a docker-compose.

This is for non-production, so I'm trying to set the single node environment variable.

Even though I'm setting it in my docker-compose, I'm still getting an error because bootstrap checks are still being performed.

Here's my docker-compose:

version: "3"
           image:  'elasticsearch'
                - '9200:9200'
                - '9300:9300'
                - bootstrap.memory_lock=true
                - discovery.type=single-node
                - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
                - cluster.routing.allocation.disk.threshold_enabled=false
                    soft: -1
                    hard: -1
           user: 'elasticsearch'

Here's the error I'm receiving:

elasticsearch_1  | {"type": "server", "timestamp": "2019-05-19T19:01:41,377+0000", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "docker-cluster", "node.name": "1cb4ad6ee202",  "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks"  }
elasticsearch_1  | ERROR: [3] bootstrap checks failed
elasticsearch_1  | [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
elasticsearch_1  | [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
elasticsearch_1  | [3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
elasticsearch_1  | {"type": "server", "timestamp": "2019-05-19T19:01:41,386+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "1cb4ad6ee202",  "message": "stopping ..."  }
elasticsearch_1  | {"type": "server", "timestamp": "2019-05-19T19:01:41,400+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "1cb4ad6ee202",  "message": "stopped"  }
elasticsearch_1  | {"type": "server", "timestamp": "2019-05-19T19:01:41,400+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "1cb4ad6ee202",  "message": "closing ..."  }
elasticsearch_1  | {"type": "server", "timestamp": "2019-05-19T19:01:41,409+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "1cb4ad6ee202",  "message": "closed"  }
elasticsearch_1  | {"type": "server", "timestamp": "2019-05-19T19:01:41,412+0000", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "docker-cluster", "node.name": "1cb4ad6ee202",  "message": "Native controller process has stopped - no new native processes can be started"  }
elasticsearch_elasticsearch_1 exited with code 78

Any suggestions would be appreciated.


It looks like it is not picking up your settings, particularly discovery.type=single-node. Is the docker-compose.yml file you quote above exactly what you are using? If so, it looks badly-formatted, containing an extra space before environment: and ulimits: compared with ports: and user: and so on.

Actually it was a silly issue on my end - what I'm actually doing is overriding the default command to run a script vs initially starting up elasticsearch which I assume is negating the settings in the docker-compose.

I'm starting via bash script so that I can add a (delayed) sub process to insert data into elasticsearch based on a file I'm reading at the time the container starts.

That brings up my next question - is there a parameter I can pass to start elasticsearch in development mode when I'm already in the container?

For instance running the command 'elasticsearch' from within the container (bash) starts elasticsearch in production mode - is there something I can pass with 'elasticsearch' to start in development mode?


Yes, you can pass settings to the elasticsearch launcher using -E, so you're looking for something like the following.

$ bin/elasticsearch -Ediscovery.type=single-node

Alternatively you can set discovery.type: single-node in elasticsearch.yml.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.