# No node available : Elasticsearch Transport Client can't connect to Docker container

**URL:** <https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883>\
**Category:** Elasticsearch\
**Created:** [July 28, 2017, 12:46am UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883 "2017-07-28T00:46:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jessec](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@Jessec](https://discuss.elastic.co/u/Jessec)\
**Post date:** [July 28, 2017, 12:46am UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/1 "2017-07-28T00:46:00Z")

</div>

Hi , I have issue connecting to elasticsearch in Docker container using Elasticsearch Transport Client.

If I curl to elasticsearch from terminal, it seems fine:

```
$ curl -XGET http://elasticsearch:9200/_nodes/http?pretty=1
    {
      "_nodes" : {
        "total" : 1,
        "successful" : 1,
        "failed" : 0
      },
      "cluster_name" : "es-cluster",
      "nodes" : {
        "NGQR55QPTyilP9kRxpT_1Q" : {
          "name" : "NGQR55Q",
          "transport_address" : "127.0.0.1:9300",
          "host" : "127.0.0.1",
          "ip" : "127.0.0.1",
          "version" : "5.5.0",
          "build_hash" : "260387d",
          "roles" : [
            "master",
            "data",
            "ingest"
          ],
          "http" : {
            "bound_address" : [
              "[::]:9200"
            ],
            "publish_address" : "172.30.254.8:9200",
            "max_content_length_in_bytes" : 104857600
          }
        }
      }
    }

```

And then I use transport client in Java program,

```
 final String clusterName = "es-cluster";
 final String hostName = "elasticsearch";
 final int port = 9200;
 final Settings settings = Settings.builder().put("cluster.name", clusterName).put("client.transport.sniff", false).build();
 TransportClient client = new PreBuiltTransportClient(settings);
 client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostName), port);

```

But when I tried to index a document, I got an exception saying no configured nodes are available.  
What confuses me is what address(or host name) and port number I should use to connect to elastic in Docker. The ES version is 5.5.0.

Any help would be very much appreciated!!!

**UPDATE**  
I solved the problem eventually.

By default the network ip for transport is 127.0.0.1 rather than 0.0.0.0. Because it’s only listening to 127.0.0.1 rahter than all interfaces, when accessing from outside the container, the transport is not accessible. So I set it to 0.0.0.0.

The problem following this is reseting the ip address triggers the bootstrap checks, which fail due to map counts check. Running “sysctl -w vm.max\_map\_count=262144” solves the problem.

---

<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:** [July 28, 2017, 1:39am UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/2 "2017-07-28T01:39:46Z")

</div>

Try with 9300 port

---

<div class="post-metadata">

**Author:** ![Jessec](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@Jessec](https://discuss.elastic.co/u/Jessec)\
**Post date:** [July 28, 2017, 2:37am UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/3 "2017-07-28T02:37:47Z")

</div>

Hi thanks for your attention!

I tried 172.30.254.8:9200, 172.30.254.8:9300 and 127.0.0.1 but none of them worked. ☹

---

<div class="post-metadata">

**Author:** ![jth1](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jth1](https://discuss.elastic.co/u/jth1)\
**Post date:** [July 28, 2017, 2:45am UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/4 "2017-07-28T02:45:58Z")

</div>

final int port = 9200; Wrong  
final int port=9300 Correct.

final String clusterName = "es-cluster"; DIFFERENT.  
The [cluster.name](http://cluster.name) you put in settings is **esClusterName** different than what you declared. Change it to your variable **clusterName**.

---

<div class="post-metadata">

**Author:** ![Jessec](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@Jessec](https://discuss.elastic.co/u/Jessec)\
**Post date:** [July 28, 2017, 3:01am UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/5 "2017-07-28T03:01:17Z")

</div>

Oh my bad I typed the code here by hand and made that error. There was no variable problem in my code. Sorry about that.

Should I use 172.30.254.8 as host? Also, is 9300 available outside docker container? If I curl 172.30.254.8:9300 or 127.0.0.1, both got connection failure.

Thank you!

---

<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:** [July 28, 2017, 5:02am UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/6 "2017-07-28T05:02:30Z")

</div>

Can you share the logs of your node?

---

<div class="post-metadata">

**Author:** ![jth1](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jth1](https://discuss.elastic.co/u/jth1)\
**Post date:** [July 28, 2017, 2:37pm UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/7 "2017-07-28T14:37:20Z")

</div>

Make sure if port 9300 of the server where elasticsearch is installed is open to your web application hosting server.

---

<div class="post-metadata">

**Author:** ![Jessec](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@Jessec](https://discuss.elastic.co/u/Jessec)\
**Post date:** [July 28, 2017, 7:40pm UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/8 "2017-07-28T19:40:30Z")

</div>

I solved the problem eventually.

By default the network ip for transport is 127.0.0.1 rather than 0.0.0.0. Because it's only listening to 127.0.0.1 rahter than all interfaces, when accessing from outside the container, the transport is not accessible. So I set it to 0.0.0.0.

The problem following this is reseting the ip address triggers the bootstrap checks, which fail due to map counts check. Running "sysctl -w vm.max\_map\_count=262144" solves the problem.

---

<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:** [July 28, 2017, 8:46pm UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/9 "2017-07-28T20:46:06Z")

</div>

That's exactly why I asked for logs.

Glad you figured it out anyway.

---

<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:** [August 25, 2017, 8:46pm UTC](https://discuss.elastic.co/t/no-node-available-elasticsearch-transport-client-cant-connect-to-docker-container/94883/10 "2017-08-25T20:46:18Z")

</div>

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