“java.net.NoRouteToHostException: No route to host” between two Docker Containers

这一生的挚爱 提交于 2019-12-25 14:13:05

问题


Note: Question is related to Bluemix docker support.

I am trying to connect two different Docker Containers deployed in Bluemix. I am getting the exception:

 java.net.NoRouteToHostException: No route to host

when I try such connection (Java EE app running on Liberty trying to access MySQL). I tried using both private and public IPs of MySQL Docker Container.

The point is that I am able to access MySQL Docker Container from outside Bluemix. So the IP, port, and MySQL itself are ok.

It seems something related to the internal networking of Docker Container support within Bluemix. If I try to access from inside Bluemix it fails, if I do from outside it works. Any help?

UPDATE: I continued investigating as you can see in comments, and it seems a timing issue. I mean, it seems once containers are up and running, there is some connectivity work still undone. If I am able to wait around 1 minute, before trying the connection it works.


回答1:


60 seconds should be the rule of thumb for the networking start working after container creation.



来源:https://stackoverflow.com/questions/32796008/java-net-noroutetohostexception-no-route-to-host-between-two-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!