# Elasticsearch cluster doesn't work when docker on machine is installed

**URL:** <https://discuss.elastic.co/t/elasticsearch-cluster-doesnt-work-when-docker-on-machine-is-installed/314952>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [September 22, 2022, 1:57pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-doesnt-work-when-docker-on-machine-is-installed/314952 "2022-09-22T13:57:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![simo385](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@simo385](https://discuss.elastic.co/u/simo385)\
**Post date:** [September 22, 2022, 1:57pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-doesnt-work-when-docker-on-machine-is-installed/314952/1 "2022-09-22T13:57:10Z")

</div>

Hi Everybody,

I have setup an Elasticsearch[8.4] cluster (2 nodes) in my aws ec2 machines as follows:

EC2\_1 (private IP: 172.31.1.1/32, docker-bridge range: 172.17.0.1/16)  
--\> in this ec2 I've installed Kubernetes master node, docker and Elasticsearch Master node

EC2\_2 (private IP: 172.31.1.2/32, docker-bridge range: 172.17.0.1/16)  
--\> in this ec2 I've installed Kubernetes worker node, docker and Elasticsearch Slave node

Kubernetes works fine.

**Issue:** As soon as I start Elasticsearch (for both nodes) I see the nodes cannot communicate between them. This happens because the nodes, inside the clusters, have the wrong IP addresses.  
It seems, Elasticsearch, at startup, takes the docker-bridge range IP instead of the EC2 range IP.

from EC2\_2 Elasticsearc logs:

```auto
[2022-09-22T08:10:35,691][WARN][o.e.d.HandshakingTransportAddressConnector] [ip-172-31-1-2] completed handshake with [{ip-172-31-1-1}{ip-172-31-1-1}{172.17.0.1}{172.17.0.1:9300}{cdfhilmrstw}] at [172.31.1.1:9300] but followup connection to [172.17.0.1:9300] failed
org.elasticsearch.transport.ConnectTransportException: [ip-172-31-1-1][172.17.0.1:9300] handshake failed. unexpected remote node {ip-172-31-1-2}{ip-172-31-1-2}{172.17.0.1}{172.17.0.1:9300}

```

If I try to stop docker.service and start Elasticsearch cluster, everything works fine! (both nodes)

I was wondering if I could set cluster nodes IP at Elasticsearch startup (the same as his EC2).

How can I solve the issue? is It an Elastisearch bug?

Thanks in advance,  
Simone

---

<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:** [October 20, 2022, 1:57pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-doesnt-work-when-docker-on-machine-is-installed/314952/2 "2022-10-20T13:57:47Z")

</div>

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