Throwing error when building elasticsearch cluster using the docker compose

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
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
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

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