title: ElasticSearch java.net.NoRouteToHostException in docker
body: <pre><code>[2015-10-11 13:08:26,587][WARN ][transport.netty          ] [Joseph] exception caught on transport layer [[id: 0x7e9f652b]], closing connection
  java.net.NoRouteToHostException: No route to host
          at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
          at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
          at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152)
          at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
          at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
          at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
          at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
          at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
  </code></pre>
  
  <p>I get this exception when launching the elasticsearch in docker (Actually I only have this problem in CentOS7 docker host)</p>
  
  <p>First, my dockefile exposes the UDP ports.</p>
  
  <pre><code>EXPOSE 9200 9300/udp 9301/udp 9302/udp 9303/udp 9304/udp 9305/udp
  </code></pre>
  
  <p>When I start the docker container, I opened these ports via <code>-p 9200:9200 -p 9300:9300/udp -p 9301:9301/udp -p 9302:9302/udp -p 9303:9303/udp -p 9304:9304/udp -p 9305:9305/udp</code></p>
  
  <p>Within <code>docker ps</code>, I do see these ports are opened as <code>0.0.0.0:9300-9305-&gt;9300-9305/udp</code></p>
  
  <p>And here is some lines of my <code>elasticsearch.yml</code></p>
  
  <pre><code>cluster.name: changsha
  discovery.zen.ping.unicast.hosts: [ "10.0.5.241" ]
  network.publish_host: 10.0.5.241
  </code></pre>
  
  <p><code>10.0.5.241</code> is my docker host's IP address. Please what is wrong here? it succeeded in CentOS6 host,  but failes on this CentOS7 host.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Following this <a href="https://serverfault.com/questions/684468/no-route-to-host-elasticsearch-exception">answer</a>, I get the following result from <code>tcpdump -p -nn icmp</code>.  </p>
  
  <pre><code>09:26:53.277117 IP 10.0.5.241 &gt; 172.17.0.8: ICMP host 10.0.5.241 unreachable - admin prohibited, length 68
  09:26:53.277494 IP 10.0.5.241 &gt; 172.17.0.8: ICMP host 10.0.5.241 unreachable - admin prohibited, length 68
  09:26:53.277822 IP 10.0.5.241 &gt; 172.17.0.8: ICMP host 10.0.5.241 unreachable - admin prohibited, length 68
  09:26:53.278043 IP 10.0.5.241 &gt; 172.17.0.8: ICMP host 10.0.5.241 unreachable - admin prohibited, length 68
  09:26:54.277753 IP 10.0.5.241 &gt; 172.17.0.8: ICMP host 10.0.5.241 unreachable - admin prohibited, length 68
  09:27:04.280703 IP 10.0.5.241 &gt; 172.17.0.8: ICMP host 10.0.5.241 unreachable - admin prohibited, length 68
  </code></pre>