# Docker & Elasticsearch using Unicast

**URL:** <https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611>\
**Category:** Elasticsearch\
**Created:** [July 11, 2014, 7:00pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611 "2014-07-11T19:00:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_P](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@Tony\_P](https://discuss.elastic.co/u/Tony_P)\
**Post date:** [July 11, 2014, 7:00pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611/1 "2014-07-11T19:00:18Z")

</div>

I've been playing with Elasticsearch and had a working cluster in a  
multicast environment using VMs. I recently tried adapting that to work  
within Docker and I'm running into a wall with the unicast configuration.

Current setup is two nodes: one on the host and another in a docker  
container (dockerfile/elasticsearch)

I'm running the container with:  
$ docker run -d -h "elasticsearch-node-01" --name="elasticsearch-node-01"   
-p 9201:9200 -p 9301:9300 -v   
/etc/elasticsearch/cluster/:/data   
dockerfile/elasticsearch /elasticsearch/bin/elasticsearch   
-Des.config=/data/elasticsearch.yml

It spins up on the docker0 bridge with some IP, 172.17.0.xx  
docker0 is bound to 172.17.42.1  
127.0.0.1 refers to the host in this example

I can access the elasticsearch node in the container with any of the  
commands:  
$ curl 127.0.0.1:9201  
$ curl 172.17.42.1:9201  
$ curl 172.17.0.xx:9200

But when I add it to a cluster via unicast, I see an exception thrown with  
"No route to host" being the reason.

After trying a few different IPs to see which could be accessed through the  
bridge, it seems that the container doesn't know how to speak to the host  
to join the host node's cluster or tell the host node that it has a cluster  
that can be joined. The host node logs also shows a similar error:

[2014-07-10 12:00:37,264][INFO][discovery.zen] [elasticsearch-node-test]  
failed to send join request to master  
[[elasticsearch-node-01][I3LiEOyeSome3djzr37uuQ][elasticsearch-node-01][inet[/172.17.0.14:9300]]],  
reason [org.elasticsearch.transport.RemoteTransportException:  
[elasticsearch-node-01][inet[/172.17.0.14:9300]][discovery/zen/join];  
org.elasticsearch.transport.ConnectTransportException:  
[elasticsearch-node-test][inet[/128.59.222.215:9300]] connect\_timeout[30s];  
java.net.NoRouteToHostException: No route to host]

There are two conversations I've found here with docker, elasticsearch and  
unicast but neither provide an answer to my issue:  
[https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ](https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ)  
[https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ](https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ)

Any ideas on what I'm doing wrong? Is it because elasticsearch is  
attempting to search based on the node's hostname (elasticsearch-node-01)  
instead of the IP address? The hostname, elasticsearch-node-01 isn't valid  
since it's just generated by passing it to docker. Should I use the IP as  
the hostname if that's what ES is using to add the node to the cluster?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 11, 2014, 11:15pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611/2 "2014-07-11T23:15:42Z")

</div>

ES will try to connect via unicast based on whatever you have in your  
config.  
What does the discovery.zen.ping.unicast line look like?

Regards,  
Mark Walkom

Infrastructure Engineer  
Campaign Monitor  
email: [markw@campaignmonitor.com](mailto:markw@campaignmonitor.com)  
web: [www.campaignmonitor.com](http://www.campaignmonitor.com)

On 12 July 2014 05:00, Tony P. [pulickaltt@gmail.com](mailto:pulickaltt@gmail.com) wrote:

> I've been playing with Elasticsearch and had a working cluster in a  
> multicast environment using VMs. I recently tried adapting that to work  
> within Docker and I'm running into a wall with the unicast configuration.
> 
> Current setup is two nodes: one on the host and another in a docker  
> container (dockerfile/elasticsearch)
> 
> I'm running the container with:  
> $ docker run -d -h "elasticsearch-node-01" --name="elasticsearch-node-01"   
> -p 9201:9200 -p 9301:9300 -v   
> /etc/elasticsearch/cluster/:/data   
> dockerfile/elasticsearch /elasticsearch/bin/elasticsearch   
> -Des.config=/data/elasticsearch.yml
> 
> It spins up on the docker0 bridge with some IP, 172.17.0.xx  
> docker0 is bound to 172.17.42.1  
> 127.0.0.1 refers to the host in this example
> 
> I can access the elasticsearch node in the container with any of the  
> commands:  
> $ curl 127.0.0.1:9201  
> $ curl 172.17.42.1:9201  
> $ curl 172.17.0.xx:9200
> 
> But when I add it to a cluster via unicast, I see an exception thrown with  
> "No route to host" being the reason.
> 
> After trying a few different IPs to see which could be accessed through  
> the bridge, it seems that the container doesn't know how to speak to the  
> host to join the host node's cluster or tell the host node that it has a  
> cluster that can be joined. The host node logs also shows a similar error:
> 
> [2014-07-10 12:00:37,264][INFO][discovery.zen] [elasticsearch-node-test]  
> failed to send join request to master  
> [[elasticsearch-node-01][I3LiEOyeSome3djzr37uuQ][elasticsearch-node-01][inet[/172.17.0.14:9300]]],  
> reason [org.elasticsearch.transport.RemoteTransportException:  
> [elasticsearch-node-01][inet[/172.17.0.14:9300]][discovery/zen/join];  
> org.elasticsearch.transport.ConnectTransportException:  
> [elasticsearch-node-test][inet[/128.59.222.215:9300]]  
> connect\_timeout[30s]; java.net.NoRouteToHostException: No route to host]
> 
> There are two conversations I've found here with docker, elasticsearch and  
> unicast but neither provide an answer to my issue:  
> [https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ](https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ)  
> [https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ](https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ)
> 
> Any ideas on what I'm doing wrong? Is it because elasticsearch is  
> attempting to search based on the node's hostname (elasticsearch-node-01)  
> instead of the IP address? The hostname, elasticsearch-node-01 isn't valid  
> since it's just generated by passing it to docker. Should I use the IP as  
> the hostname if that's what ES is using to add the node to the cluster?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEM624YE\_web%3Dk%2BYLeXTHH1dKpZuVk72GPthtSHrAgqecsk%2B2Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEM624YE_web%3Dk%2BYLeXTHH1dKpZuVk72GPthtSHrAgqecsk%2B2Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Tony\_P](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@Tony\_P](https://discuss.elastic.co/u/Tony_P)\
**Post date:** [July 14, 2014, 1:13pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611/3 "2014-07-14T13:13:51Z")

</div>

I've tried a few different things to no avail.

Current setup:

# vain effort to attempt to have the host find the node in the docker

container  
host: discovery.zen.ping.unicast.hosts: ["127.0.0.1", "172.17.0.14"]  
container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

# Which won't be particularly effective since the next time I restart the

docker container its IP will change.

I've also tried:

# accessing the host from the docker container

host: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]  
container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

# having the host use the docker0 bridge which theoretically should have

worked since I mapped 9201 on docker0 to 9200 on the docker container  
host: discovery.zen.ping.unicast.hosts: ["172.17.42.1:9200",  
"172.17.42.1:9201"]

# same as above except using the host's actual IP and the same port mapping

across docker0  
host: discovery.zen.ping.unicast.hosts: ["xxx.xxx.222.206:9200",  
"xxx.xxx.222.206:9201"]

I can curl all of these IPs at 9200/9201 and get a response from the  
desired ES node.

On Friday, July 11, 2014 7:16:17 PM UTC-4, Mark Walkom wrote:

> ES will try to connect via unicast based on whatever you have in your  
> config.  
> What does the discovery.zen.ping.unicast line look like?
> 
> Regards,  
> Mark Walkom
> 
> Infrastructure Engineer  
> Campaign Monitor  
> email: [ma...@campaignmonitor.com](mailto:ma...@campaignmonitor.com) \<javascript:\>  
> web: [www.campaignmonitor.com](http://www.campaignmonitor.com)
> 
> On 12 July 2014 05:00, Tony P. \<[pulic...@gmail.com](mailto:pulic...@gmail.com) \<javascript:\>\> wrote:
> 
> > I've been playing with Elasticsearch and had a working cluster in a  
> > multicast environment using VMs. I recently tried adapting that to work  
> > within Docker and I'm running into a wall with the unicast configuration.
> > 
> > Current setup is two nodes: one on the host and another in a docker  
> > container (dockerfile/elasticsearch)
> > 
> > I'm running the container with:  
> > $ docker run -d -h "elasticsearch-node-01" --name="elasticsearch-node-01"  
> >   
> > -p 9201:9200 -p 9301:9300 -v   
> > /etc/elasticsearch/cluster/:/data   
> > dockerfile/elasticsearch /elasticsearch/bin/elasticsearch   
> > -Des.config=/data/elasticsearch.yml
> > 
> > It spins up on the docker0 bridge with some IP, 172.17.0.xx  
> > docker0 is bound to 172.17.42.1  
> > 127.0.0.1 refers to the host in this example
> > 
> > I can access the elasticsearch node in the container with any of the  
> > commands:  
> > $ curl 127.0.0.1:9201  
> > $ curl 172.17.42.1:9201  
> > $ curl 172.17.0.xx:9200
> > 
> > But when I add it to a cluster via unicast, I see an exception thrown  
> > with "No route to host" being the reason.
> > 
> > After trying a few different IPs to see which could be accessed through  
> > the bridge, it seems that the container doesn't know how to speak to the  
> > host to join the host node's cluster or tell the host node that it has a  
> > cluster that can be joined. The host node logs also shows a similar error:
> > 
> > [2014-07-10 12:00:37,264][INFO][discovery.zen] [elasticsearch-node-test]  
> > failed to send join request to master  
> > [[elasticsearch-node-01][I3LiEOyeSome3djzr37uuQ][elasticsearch-node-01][inet[/172.17.0.14:9300]]],  
> > reason [org.elasticsearch.transport.RemoteTransportException:  
> > [elasticsearch-node-01][inet[/172.17.0.14:9300]][discovery/zen/join];  
> > org.elasticsearch.transport.ConnectTransportException:  
> > [elasticsearch-node-test][inet[/128.59.222.215:9300]]  
> > connect\_timeout[30s]; java.net.NoRouteToHostException: No route to host]
> > 
> > There are two conversations I've found here with docker, elasticsearch  
> > and unicast but neither provide an answer to my issue:  
> > [https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ](https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ)  
> > [https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ](https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ)
> > 
> > Any ideas on what I'm doing wrong? Is it because elasticsearch is  
> > attempting to search based on the node's hostname (elasticsearch-node-01)  
> > instead of the IP address? The hostname, elasticsearch-node-01 isn't valid  
> > since it's just generated by passing it to docker. Should I use the IP as  
> > the hostname if that's what ES is using to add the node to the cluster?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [July 14, 2014, 1:48pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611/4 "2014-07-14T13:48:48Z")

</div>

curl uses TCP, but for multicast/unicast, you need also UDP.

Jörg

On Mon, Jul 14, 2014 at 3:13 PM, Tony P. [pulickaltt@gmail.com](mailto:pulickaltt@gmail.com) wrote:

> I've tried a few different things to no avail.
> 
> Current setup:
> 
> # vain effort to attempt to have the host find the node in the docker
> 
> container  
> host: discovery.zen.ping.unicast.hosts: ["127.0.0.1", "172.17.0.14"]  
> container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> 
> # Which won't be particularly effective since the next time I restart the
> 
> docker container its IP will change.
> 
> I've also tried:
> 
> # accessing the host from the docker container
> 
> host: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]  
> container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> 
> # having the host use the docker0 bridge which theoretically should have
> 
> worked since I mapped 9201 on docker0 to 9200 on the docker container  
> host: discovery.zen.ping.unicast.hosts: ["172.17.42.1:9200", "  
> 172.17.42.1:9201"]
> 
> # same as above except using the host's actual IP and the same port
> 
> mapping across docker0  
> host: discovery.zen.ping.unicast.hosts: ["xxx.xxx.222.206:9200",  
> "xxx.xxx.222.206:9201"]
> 
> I can curl all of these IPs at 9200/9201 and get a response from the  
> desired ES node.
> 
> On Friday, July 11, 2014 7:16:17 PM UTC-4, Mark Walkom wrote:
> 
> > ES will try to connect via unicast based on whatever you have in your  
> > config.  
> > What does the discovery.zen.ping.unicast line look like?
> > 
> > Regards,  
> > Mark Walkom
> > 
> > Infrastructure Engineer  
> > Campaign Monitor  
> > email: [ma...@campaignmonitor.com](mailto:ma...@campaignmonitor.com)  
> > web: [www.campaignmonitor.com](http://www.campaignmonitor.com)
> > 
> > On 12 July 2014 05:00, Tony P. [pulic...@gmail.com](mailto:pulic...@gmail.com) wrote:
> > 
> > > I've been playing with Elasticsearch and had a working cluster in a  
> > > multicast environment using VMs. I recently tried adapting that to work  
> > > within Docker and I'm running into a wall with the unicast configuration.
> > > 
> > > Current setup is two nodes: one on the host and another in a docker  
> > > container (dockerfile/elasticsearch)
> > > 
> > > I'm running the container with:  
> > > $ docker run -d -h "elasticsearch-node-01"  
> > > --name="elasticsearch-node-01"   
> > > -p 9201:9200 -p 9301:9300 -v   
> > > /etc/elasticsearch/cluster/:/data   
> > > dockerfile/elasticsearch /elasticsearch/bin/elasticsearch   
> > > -Des.config=/data/elasticsearch.yml
> > > 
> > > It spins up on the docker0 bridge with some IP, 172.17.0.xx  
> > > docker0 is bound to 172.17.42.1  
> > > 127.0.0.1 refers to the host in this example
> > > 
> > > I can access the elasticsearch node in the container with any of the  
> > > commands:  
> > > $ curl 127.0.0.1:9201  
> > > $ curl 172.17.42.1:9201  
> > > $ curl 172.17.0.xx:9200
> > > 
> > > But when I add it to a cluster via unicast, I see an exception thrown  
> > > with "No route to host" being the reason.
> > > 
> > > After trying a few different IPs to see which could be accessed through  
> > > the bridge, it seems that the container doesn't know how to speak to the  
> > > host to join the host node's cluster or tell the host node that it has a  
> > > cluster that can be joined. The host node logs also shows a similar error:
> > > 
> > > [2014-07-10 12:00:37,264][INFO][discovery.zen]  
> > > [elasticsearch-node-test] failed to send join request to master  
> > > [[elasticsearch-node-01][I3LiEOyeSome3djzr37uuQ][  
> > > elasticsearch-node-01][inet[/172.17.0.14:9300]]], reason  
> > > [org.elasticsearch.transport.RemoteTransportException:  
> > > [elasticsearch-node-01][inet[/172.17.0.14:9300]][discovery/zen/join];  
> > > org.elasticsearch.transport.ConnectTransportException:  
> > > [elasticsearch-node-test][inet[/128.59.222.215:9300]]  
> > > connect\_timeout[30s]; java.net.NoRouteToHostException: No route to host]
> > > 
> > > There are two conversations I've found here with docker, elasticsearch  
> > > and unicast but neither provide an answer to my issue:  
> > > [https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ](https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ)  
> > > [https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ](https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ)
> > > 
> > > Any ideas on what I'm doing wrong? Is it because elasticsearch is  
> > > attempting to search based on the node's hostname (elasticsearch-node-01)  
> > > instead of the IP address? The hostname, elasticsearch-node-01 isn't valid  
> > > since it's just generated by passing it to docker. Should I use the IP as  
> > > the hostname if that's what ES is using to add the node to the cluster?
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGdVNHqRLR88mCg5ZxnzYjNXQTNMCz8wv%3DzMQ%3DL\_RwMmg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGdVNHqRLR88mCg5ZxnzYjNXQTNMCz8wv%3DzMQ%3DL_RwMmg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Tony\_P](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@Tony\_P](https://discuss.elastic.co/u/Tony_P)\
**Post date:** [July 14, 2014, 4:01pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611/5 "2014-07-14T16:01:52Z")

</div>

Ah, learned something new. I've updated my iptables to accept tcp and udp  
for 9200:9400. However, I'm still running into the same error. I'm still  
getting the earlier mentioned error message when using the container's IP  
(not ideal). When I use the following unicast list on the host:

host: discovery.zen.ping.unicast.hosts: ["172.17.42.1:9200", "  
172.17.42.1:9201"]

I get the following on the host and the associated exception on the  
container:

[2014-07-14 11:48:50,357][WARN][discovery.zen.ping.unicast]  
[elasticsearch-node-00] failed to send ping to  
[[#zen\_unicast\_2#][elasticsearch-node-00][inet[/172.17.42.1:9201]]]  
org.elasticsearch.transport.ReceiveTimeoutTransportException:  
[inet[/172.17.42.1:9201]][discovery/zen/unicast] request\_id [0] timed out  
after [3751ms]  
at  
org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:356)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:744)

I'm pretty sure this is an issue with my iptables config. I don't get the  
stack traces on the container after flushing my iptable rules but I do  
still receive the above error message on the host. I'm wondering if it has  
something to do with these two lines that docker adds to my iptables rules

```
0 0 ACCEPT tcp -- !docker0 docker0 0.0.0.0/0           

```

172.17.0.2 tcp dpt:9300  
0 0 ACCEPT tcp -- !docker0 docker0 0.0.0.0/0  
172.17.0.2 tcp dpt:9200

Do I need to manually add additional rules to allow the host to discover  
the container?

On Monday, July 14, 2014 9:48:58 AM UTC-4, Jörg Prante wrote:

> curl uses TCP, but for multicast/unicast, you need also UDP.
> 
> Jörg
> 
> On Mon, Jul 14, 2014 at 3:13 PM, Tony P. \<[pulic...@gmail.com](mailto:pulic...@gmail.com) \<javascript:\>
> 
> > wrote:
> 
> > I've tried a few different things to no avail.
> > 
> > Current setup:
> > 
> > # vain effort to attempt to have the host find the node in the docker
> > 
> > container  
> > host: discovery.zen.ping.unicast.hosts: ["127.0.0.1", "172.17.0.14"]  
> > container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> > 
> > # Which won't be particularly effective since the next time I restart the
> > 
> > docker container its IP will change.
> > 
> > I've also tried:
> > 
> > # accessing the host from the docker container
> > 
> > host: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]  
> > container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> > 
> > # having the host use the docker0 bridge which theoretically should have
> > 
> > worked since I mapped 9201 on docker0 to 9200 on the docker container  
> > host: discovery.zen.ping.unicast.hosts: ["172.17.42.1:9200", "  
> > 172.17.42.1:9201"]
> > 
> > # same as above except using the host's actual IP and the same port
> > 
> > mapping across docker0  
> > host: discovery.zen.ping.unicast.hosts: ["xxx.xxx.222.206:9200",  
> > "xxx.xxx.222.206:9201"]
> > 
> > I can curl all of these IPs at 9200/9201 and get a response from the  
> > desired ES node.
> > 
> > On Friday, July 11, 2014 7:16:17 PM UTC-4, Mark Walkom wrote:
> > 
> > > ES will try to connect via unicast based on whatever you have in your  
> > > config.  
> > > What does the discovery.zen.ping.unicast line look like?
> > > 
> > > Regards,  
> > > Mark Walkom
> > > 
> > > Infrastructure Engineer  
> > > Campaign Monitor  
> > > email: [ma...@campaignmonitor.com](mailto:ma...@campaignmonitor.com)  
> > > web: [www.campaignmonitor.com](http://www.campaignmonitor.com)
> > > 
> > > On 12 July 2014 05:00, Tony P. [pulic...@gmail.com](mailto:pulic...@gmail.com) wrote:
> > > 
> > > > I've been playing with Elasticsearch and had a working cluster in a  
> > > > multicast environment using VMs. I recently tried adapting that to work  
> > > > within Docker and I'm running into a wall with the unicast configuration.
> > > > 
> > > > Current setup is two nodes: one on the host and another in a docker  
> > > > container (dockerfile/elasticsearch)
> > > > 
> > > > I'm running the container with:  
> > > > $ docker run -d -h "elasticsearch-node-01"  
> > > > --name="elasticsearch-node-01"   
> > > > -p 9201:9200 -p 9301:9300 -v   
> > > > /etc/elasticsearch/cluster/:/data   
> > > > dockerfile/elasticsearch /elasticsearch/bin/elasticsearch   
> > > > -Des.config=/data/elasticsearch.yml
> > > > 
> > > > It spins up on the docker0 bridge with some IP, 172.17.0.xx  
> > > > docker0 is bound to 172.17.42.1  
> > > > 127.0.0.1 refers to the host in this example
> > > > 
> > > > I can access the elasticsearch node in the container with any of the  
> > > > commands:  
> > > > $ curl 127.0.0.1:9201  
> > > > $ curl 172.17.42.1:9201  
> > > > $ curl 172.17.0.xx:9200
> > > > 
> > > > But when I add it to a cluster via unicast, I see an exception thrown  
> > > > with "No route to host" being the reason.
> > > > 
> > > > After trying a few different IPs to see which could be accessed through  
> > > > the bridge, it seems that the container doesn't know how to speak to the  
> > > > host to join the host node's cluster or tell the host node that it has a  
> > > > cluster that can be joined. The host node logs also shows a similar error:
> > > > 
> > > > [2014-07-10 12:00:37,264][INFO][discovery.zen]  
> > > > [elasticsearch-node-test] failed to send join request to master  
> > > > [[elasticsearch-node-01][I3LiEOyeSome3djzr37uuQ][  
> > > > elasticsearch-node-01][inet[/172.17.0.14:9300]]], reason  
> > > > [org.elasticsearch.transport.RemoteTransportException:  
> > > > [elasticsearch-node-01][inet[/172.17.0.14:9300]][discovery/zen/join];  
> > > > org.elasticsearch.transport.ConnectTransportException:  
> > > > [elasticsearch-node-test][inet[/128.59.222.215:9300]]  
> > > > connect\_timeout[30s]; java.net.NoRouteToHostException: No route to  
> > > > host]
> > > > 
> > > > There are two conversations I've found here with docker, elasticsearch  
> > > > and unicast but neither provide an answer to my issue:  
> > > > [https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ](https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ)  
> > > > [https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ](https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ)
> > > > 
> > > > Any ideas on what I'm doing wrong? Is it because elasticsearch is  
> > > > attempting to search based on the node's hostname (elasticsearch-node-01)  
> > > > instead of the IP address? The hostname, elasticsearch-node-01 isn't valid  
> > > > since it's just generated by passing it to docker. Should I use the IP as  
> > > > the hostname if that's what ES is using to add the node to the cluster?
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups  
> > > "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a49267e3-89b9-461d-8307-693b4ca82ab2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a49267e3-89b9-461d-8307-693b4ca82ab2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Tony\_P](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@Tony\_P](https://discuss.elastic.co/u/Tony_P)\
**Post date:** [July 14, 2014, 4:14pm UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611/6 "2014-07-14T16:14:22Z")

</div>

I got it to work without my iptables rules loaded by changing my discovery  
settings on both my host and container to:

discovery.zen.ping.unicast.hosts: ["172.17.42.1:9300", "172.17.42.1:9301"]

Thanks for all of your help! Knowing Docker needed UDP access helped quite  
a bit.

On Monday, July 14, 2014 12:01:52 PM UTC-4, Tony P. wrote:

> Ah, learned something new. I've updated my iptables to accept tcp and udp  
> for 9200:9400. However, I'm still running into the same error. I'm still  
> getting the earlier mentioned error message when using the container's IP  
> (not ideal). When I use the following unicast list on the host:
> 
> host: discovery.zen.ping.unicast.hosts: ["172.17.42.1:9200", "  
> 172.17.42.1:9201"]
> 
> I get the following on the host and the associated exception on the  
> container:
> 
> [2014-07-14 11:48:50,357][WARN][discovery.zen.ping.unicast]  
> [elasticsearch-node-00] failed to send ping to  
> [[#zen\_unicast\_2#][elasticsearch-node-00][inet[/172.17.42.1:9201]]]  
> org.elasticsearch.transport.ReceiveTimeoutTransportException:  
> [inet[/172.17.42.1:9201]][discovery/zen/unicast] request\_id [0] timed out  
> after [3751ms]  
> at  
> org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:356)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:744)
> 
> I'm pretty sure this is an issue with my iptables config. I don't get the  
> stack traces on the container after flushing my iptable rules but I do  
> still receive the above error message on the host. I'm wondering if it has  
> something to do with these two lines that docker adds to my iptables rules
> 
> ```
> 0 0 ACCEPT tcp -- !docker0 docker0 0.0.0.0/0           
> 
> ```
> 
> 172.17.0.2 tcp dpt:9300  
> 0 0 ACCEPT tcp -- !docker0 docker0 0.0.0.0/0  
> 172.17.0.2 tcp dpt:9200
> 
> Do I need to manually add additional rules to allow the host to discover  
> the container?
> 
> On Monday, July 14, 2014 9:48:58 AM UTC-4, Jörg Prante wrote:
> 
> > curl uses TCP, but for multicast/unicast, you need also UDP.
> > 
> > Jörg
> > 
> > On Mon, Jul 14, 2014 at 3:13 PM, Tony P. [pulic...@gmail.com](mailto:pulic...@gmail.com) wrote:
> > 
> > > I've tried a few different things to no avail.
> > > 
> > > Current setup:
> > > 
> > > # vain effort to attempt to have the host find the node in the docker
> > > 
> > > container  
> > > host: discovery.zen.ping.unicast.hosts: ["127.0.0.1", "172.17.0.14"]  
> > > container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> > > 
> > > # Which won't be particularly effective since the next time I restart
> > > 
> > > the docker container its IP will change.
> > > 
> > > I've also tried:
> > > 
> > > # accessing the host from the docker container
> > > 
> > > host: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]  
> > > container: discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> > > 
> > > # having the host use the docker0 bridge which theoretically should have
> > > 
> > > worked since I mapped 9201 on docker0 to 9200 on the docker container  
> > > host: discovery.zen.ping.unicast.hosts: ["172.17.42.1:9200", "  
> > > 172.17.42.1:9201"]
> > > 
> > > # same as above except using the host's actual IP and the same port
> > > 
> > > mapping across docker0  
> > > host: discovery.zen.ping.unicast.hosts: ["xxx.xxx.222.206:9200",  
> > > "xxx.xxx.222.206:9201"]
> > > 
> > > I can curl all of these IPs at 9200/9201 and get a response from the  
> > > desired ES node.
> > > 
> > > On Friday, July 11, 2014 7:16:17 PM UTC-4, Mark Walkom wrote:
> > > 
> > > > ES will try to connect via unicast based on whatever you have in your  
> > > > config.  
> > > > What does the discovery.zen.ping.unicast line look like?
> > > > 
> > > > Regards,  
> > > > Mark Walkom
> > > > 
> > > > Infrastructure Engineer  
> > > > Campaign Monitor  
> > > > email: [ma...@campaignmonitor.com](mailto:ma...@campaignmonitor.com)  
> > > > web: [www.campaignmonitor.com](http://www.campaignmonitor.com)
> > > > 
> > > > On 12 July 2014 05:00, Tony P. [pulic...@gmail.com](mailto:pulic...@gmail.com) wrote:
> > > > 
> > > > > I've been playing with Elasticsearch and had a working cluster in a  
> > > > > multicast environment using VMs. I recently tried adapting that to work  
> > > > > within Docker and I'm running into a wall with the unicast configuration.
> > > > > 
> > > > > Current setup is two nodes: one on the host and another in a docker  
> > > > > container (dockerfile/elasticsearch)
> > > > > 
> > > > > I'm running the container with:  
> > > > > $ docker run -d -h "elasticsearch-node-01"  
> > > > > --name="elasticsearch-node-01"   
> > > > > -p 9201:9200 -p 9301:9300 -v   
> > > > > /etc/elasticsearch/cluster/:/data   
> > > > > dockerfile/elasticsearch /elasticsearch/bin/elasticsearch   
> > > > > -Des.config=/data/elasticsearch.yml
> > > > > 
> > > > > It spins up on the docker0 bridge with some IP, 172.17.0.xx  
> > > > > docker0 is bound to 172.17.42.1  
> > > > > 127.0.0.1 refers to the host in this example
> > > > > 
> > > > > I can access the elasticsearch node in the container with any of the  
> > > > > commands:  
> > > > > $ curl 127.0.0.1:9201  
> > > > > $ curl 172.17.42.1:9201  
> > > > > $ curl 172.17.0.xx:9200
> > > > > 
> > > > > But when I add it to a cluster via unicast, I see an exception thrown  
> > > > > with "No route to host" being the reason.
> > > > > 
> > > > > After trying a few different IPs to see which could be accessed  
> > > > > through the bridge, it seems that the container doesn't know how to speak  
> > > > > to the host to join the host node's cluster or tell the host node that it  
> > > > > has a cluster that can be joined. The host node logs also shows a similar  
> > > > > error:
> > > > > 
> > > > > [2014-07-10 12:00:37,264][INFO][discovery.zen]  
> > > > > [elasticsearch-node-test] failed to send join request to master  
> > > > > [[elasticsearch-node-01][I3LiEOyeSome3djzr37uuQ][  
> > > > > elasticsearch-node-01][inet[/172.17.0.14:9300]]], reason  
> > > > > [org.elasticsearch.transport.RemoteTransportException:  
> > > > > [elasticsearch-node-01][inet[/172.17.0.14:9300]][discovery/zen/join];  
> > > > > org.elasticsearch.transport.ConnectTransportException:  
> > > > > [elasticsearch-node-test][inet[/128.59.222.215:9300]]  
> > > > > connect\_timeout[30s]; java.net.NoRouteToHostException: No route to  
> > > > > host]
> > > > > 
> > > > > There are two conversations I've found here with docker, elasticsearch  
> > > > > and unicast but neither provide an answer to my issue:  
> > > > > [https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ](https://groups.google.com/d/msg/elasticsearch/OsGJcxuW1vI/qybPOrgE4fMJ)  
> > > > > [https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ](https://groups.google.com/d/msg/elasticsearch/2p9jXbCwRC8/mm4BPt5iQfgJ)
> > > > > 
> > > > > Any ideas on what I'm doing wrong? Is it because elasticsearch is  
> > > > > attempting to search based on the node's hostname (elasticsearch-node-01)  
> > > > > instead of the IP address? The hostname, elasticsearch-node-01 isn't valid  
> > > > > since it's just generated by passing it to docker. Should I use the IP as  
> > > > > the hostname if that's what ES is using to add the node to the cluster?
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > > 
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%  
> > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d52a92e3-0956-48b6-8816-cea5ed31a412%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a6f26f35-9b9e-44e6-9392-8f1bdfb2b1ea%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ac7e5c06-9c8e-4cc7-acc2-6f75bf672fb9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac7e5c06-9c8e-4cc7-acc2-6f75bf672fb9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:16am UTC](https://discuss.elastic.co/t/docker-elasticsearch-using-unicast/18611/7 "2017-07-06T01:16:01Z")

</div>


