# Throwing error when building elasticsearch cluster using the docker compose

**URL:** <https://discuss.elastic.co/t/throwing-error-when-building-elasticsearch-cluster-using-the-docker-compose/159976>\
**Category:** Elasticsearch\
**Created:** [December 7, 2018, 8:10pm UTC](https://discuss.elastic.co/t/throwing-error-when-building-elasticsearch-cluster-using-the-docker-compose/159976 "2018-12-07T20:10:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravikt](https://avatars.discourse-cdn.com/v4/letter/r/dfb087/32.png) [@ravikt](https://discuss.elastic.co/u/ravikt)\
**Post date:** [December 7, 2018, 8:10pm UTC](https://discuss.elastic.co/t/throwing-error-when-building-elasticsearch-cluster-using-the-docker-compose/159976/1 "2018-12-07T20:10:17Z")

</div>

I am trying to set up an ElasticSearch cluster on AWS EC2 instance(Amazon Linux AMI) using the docker-compose.yml file. I am getting errorat the end when trying to run container using command _docker-compose up_ .  
Could you please advise?

docker-compose.yml

version: '2.2'  
services:  
elasticsearch:  
image: [docker.elastic.co/elasticsearch/elasticsearch:6.4.1](http://docker.elastic.co/elasticsearch/elasticsearch:6.4.1)  
container\_name: elasticsearch  
environment:  
- ES\_HEAP\_SIZE=512m  
- cluster.name=docker-cluster  
- bootstrap.memory\_lock=true  
- "ES\_JAVA\_OPTS=-Xms512m -Xmx512m"

```
ulimits:
  memlock:
    soft: -1
    hard: -1
volumes:
  - esdata1:/usr/share/elasticsearch/data
ports:
  - 9200:9200
  - 9300:9300
networks:
  - esnet

```

elasticsearch2:  
image: [docker.elastic.co/elasticsearch/elasticsearch:6.4.1](http://docker.elastic.co/elasticsearch/elasticsearch:6.4.1)  
container\_name: elasticsearch2  
environment:  
- ES\_HEAP\_SIZE=512m  
- cluster.name=docker-cluster  
- bootstrap.memory\_lock=true  
- "ES\_JAVA\_OPTS=-Xms512m -Xmx512m"  
- "discovery.zen.ping.unicast.hosts=elasticsearch"  
ulimits:  
memlock:  
soft: -1  
hard: -1  
volumes:  
- esdata2:/usr/share/elasticsearch/data  
networks:  
- esnet

volumes:  
esdata1:  
driver: local  
esdata2:  
driver: local

networks:  
esnet:

Error:  
elasticsearch | [1]: max file descriptors [4096] for elasticsearch process i s too low, increase to at least [65536]  
elasticsearch | [2]: max virtual memory areas vm.max\_map\_count [65530] is to o low, increase to at least [262144]  
elasticsearch | [2018-12-07T19:45:39,479][INFO][o.e.n.Node] [dUPHXe-] stopping ...  
elasticsearch2 | [2018-12-07T19:45:39,541][INFO][o.e.t.TransportService] [g9jfBKY] publish\_address {172.18.0.2:9300}, bound\_addresses {0.0.0.0:9300}  
elasticsearch2 | [2018-12-07T19:45:39,561][INFO][o.e.b.BootstrapChecks] [g9jfBKY] bound or publishing to a non-loopback address, enforcing bootstrap che cks  
elasticsearch | [2018-12-07T19:45:39,568][INFO][o.e.n.Node] [dUPHXe-] stopped  
elasticsearch | [2018-12-07T19:45:39,569][INFO][o.e.n.Node] [dUPHXe-] closing ...  
elasticsearch2 | ERROR: [2] bootstrap checks failed  
elasticsearch2 | [1]: max file descriptors [4096] for elasticsearch process i s too low, increase to at least [65536]  
elasticsearch2 | [2]: max virtual memory areas vm.max\_map\_count [65530] is to o low, increase to at least [262144]  
elasticsearch2 | [2018-12-07T19:45:39,580][INFO][o.e.n.Node] [g9jfBKY] stopping ...  
elasticsearch | [2018-12-07T19:45:39,589][INFO][o.e.n.Node] [dUPHXe-] closed  
elasticsearch | [2018-12-07T19:45:39,591][INFO][o.e.x.m.j.p.NativeControlle r] Native controller process has stopped - no new native processes can be starte d  
elasticsearch2 | [2018-12-07T19:45:39,663][INFO][o.e.n.Node] [g9jfBKY] stopped  
elasticsearch2 | [2018-12-07T19:45:39,664][INFO][o.e.n.Node] [g9jfBKY] closing ...  
elasticsearch2 | [2018-12-07T19:45:39,685][INFO][o.e.n.Node] [g9jfBKY] closed  
elasticsearch2 | [2018-12-07T19:45:39,687][INFO][o.e.x.m.j.p.NativeControlle r] Native controller process has stopped - no new native processes can be starte d  
elasticsearch2 exited with code 78  
elasticsearch exited with code 78

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 4, 2019, 8:29pm UTC](https://discuss.elastic.co/t/throwing-error-when-building-elasticsearch-cluster-using-the-docker-compose/159976/2 "2019-01-04T20:29:41Z")

</div>

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