# Docker Compose elastic Cluster setup

**URL:** <https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387>\
**Category:** Elasticsearch\
**Created:** [May 29, 2017, 3:58am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387 "2017-05-29T03:58:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Purohit](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Abhishek\_Purohit](https://discuss.elastic.co/u/Abhishek_Purohit)\
**Post date:** [May 29, 2017, 3:58am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/1 "2017-05-29T03:58:12Z")

</div>

Hi!

Please find that we are able to set up a single elastic search server and kibana suing docker-compose. But when we try to set up a cluster using the following we face issues while starting elastic search.

The elasticsearch1 server exit with exit code 137 which is soon followed by elasticsearch2 and then kibana. Please see docker-compose.yml below.

Any ideas / suggestion?

Regards,  
Abhishek

Docker-compose.yml

version: '2'  
services:  
elasticsearch1:  
image: [docker.elastic.co/elasticsearch/elasticsearch:5.4.0](http://docker.elastic.co/elasticsearch/elasticsearch:5.4.0)  
container\_name: elasticsearch1  
environment:  
- cluster.name=docker-cluster  
- xpack.security.enabled=false  
- http.cors.enabled=true  
- http.cors.allow-origin=http://local.test.xxxxx.com:4200  
- http.cors.allow-headers=Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With  
- http.cors.allow-credentials=true  
- bootstrap.memory\_lock=true  
- "ES\_JAVA\_OPTS=-Xms512m -Xmx512m"  
ulimits:  
memlock:  
soft: -1  
hard: -1  
mem\_limit: 1g  
volumes:  
- esdata1:/usr/share/elasticsearch/data  
ports:  
- 9200:9200  
networks:  
- esnet  
elasticsearch2:  
image: [docker.elastic.co/elasticsearch/elasticsearch:5.4.0](http://docker.elastic.co/elasticsearch/elasticsearch:5.4.0)  
environment:  
- cluster.name=docker-cluster  
- xpack.security.enabled=false  
- http.cors.enabled=true  
- http.cors.allow-origin=http://local.test.xxxxx.com:4200  
- http.cors.allow-headers=Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With  
- http.cors.allow-credentials=true  
- bootstrap.memory\_lock=true  
- "ES\_JAVA\_OPTS=-Xms512m -Xmx512m"  
- "discovery.zen.ping.unicast.hosts=elasticsearch1"  
ulimits:  
memlock:  
soft: -1  
hard: -1  
nofile:  
soft: 65536  
hard: 65536  
mem\_limit: 1g  
cap\_add:  
- IPC\_LOCK  
volumes:  
- esdata2:/usr/share/elasticsearch/data  
ports:  
- 9201:9200  
links:  
- "elasticsearch1:elastic-url"  
networks:  
- esnet  
kibana:  
image: [docker.elastic.co/kibana/kibana:5.4.0](http://docker.elastic.co/kibana/kibana:5.4.0)  
container\_name: kibana  
environment:  
- http.host=0.0.0.0  
- transport.host=127.0.0.1  
- "ELASTICSEARCH\_USERNAME=elastic"  
- "ELASTICSEARCH\_PASSWORD=changeme"  
- "ELASTICSEARCH\_URL=http://elasticsearch1:9200"  
ports:  
- 5601:5601  
links:  
- "elasticsearch1:elastic-url"  
networks:  
- esnet

volumes:  
esdata1:  
driver: local  
esdata2:  
driver: local  
networks:  
esnet:

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 29, 2017, 5:05am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/2 "2017-05-29T05:05:23Z")

</div>

This looks wrong:

```
9201:9200

```

Should be

```
9201:9201
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 29, 2017, 5:58am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/3 "2017-05-29T05:58:02Z")

</div>

We also have docker-compose files for the stack here - [https://github.com/elastic/stack-docker](https://github.com/elastic/stack-docker)

---

<div class="post-metadata">

**Author:** ![Abhishek\_Purohit](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Abhishek\_Purohit](https://discuss.elastic.co/u/Abhishek_Purohit)\
**Post date:** [May 29, 2017, 6:06am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/4 "2017-05-29T06:06:42Z")

</div>

in my opinion elasticsearch will always start on port 9200 in the container but we can expose them on different port - 9201 to the outside for the second server in the cluster.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Purohit](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Abhishek\_Purohit](https://discuss.elastic.co/u/Abhishek_Purohit)\
**Post date:** [May 29, 2017, 6:08am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/5 "2017-05-29T06:08:47Z")

</div>

Thank you for sharing the link but this file doesn't have the elasticsearch server on a cluster. We have no problem running the single instance but face issue when starting the 2 server in the cluster.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 29, 2017, 7:16am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/6 "2017-05-29T07:16:23Z")

</div>

Ha sorry. You're right. I misread the config file. I thought it was an elasticsearch setting `http.port: 9201-9200` which is not the case.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Purohit](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Abhishek\_Purohit](https://discuss.elastic.co/u/Abhishek_Purohit)\
**Post date:** [May 29, 2017, 11:50am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/7 "2017-05-29T11:50:45Z")

</div>

No need to apologies! we all are in this together trying to explore this wonderful technology

---

<div class="post-metadata">

**Author:** ![skunkwerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skunkwerk/32/18890_2.png) [@skunkwerk](https://discuss.elastic.co/u/skunkwerk)\
**Post date:** [June 19, 2017, 11:32pm UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/8 "2017-06-19T23:32:30Z")

</div>

Hi. I'm also trying to get a elastic/kibana/logstash node setup using Docker compose.

I'm using [this configuration](https://paste.ee/p/PGsjs), based off the official [one](https://github.com/elastic/stack-docker/blob/master/docker-compose.yml).

When I run this command, I get the following error from configure\_kibana:

sudo ELASTIC\_VERSION=5.4.0 TAG=5.4.0 docker-compose up  
ubuntu\_elasticsearch\_1 is up-to-date  
ubuntu\_kibana\_1 is up-to-date  
Starting ubuntu\_logstash\_1  
Starting ubuntu\_configure\_kibana\_1  
Attaching to ubuntu\_elasticsearch\_1, ubuntu\_kibana\_1, ubuntu\_logstash\_1, ubuntu\_configure\_kibana\_1  
configure\_kibana\_1 | cat: /usr/local/bin/configure-kibana.sh: Is a directory  
...  
...  
ubuntu\_configure\_kibana\_1 exited with code 0

I have the config/logstash.conf file in my home directory. What could be wrong?

thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 20, 2017, 1:41am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/9 "2017-06-20T01:41:26Z")

</div>

It'd be better if you created your own thread 🙂

---

<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:** [July 18, 2017, 1:41am UTC](https://discuss.elastic.co/t/docker-compose-elastic-cluster-setup/87387/10 "2017-07-18T01:41:56Z")

</div>

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