简体   繁体   English

两个Docker容器之间的“ java.net.NoRouteToHostException:没有路由到主机”

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

Note: Question is related to Bluemix docker support. 注意:问题与Bluemix docker支持有关。

I am trying to connect two different Docker Containers deployed in Bluemix. 我试图连接部署在Bluemix中的两个不同的Docker容器。 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). 当我尝试进行这种连接时(在Liberty上运行的Java EE应用试图访问MySQL)。 I tried using both private and public IPs of MySQL Docker Container. 我尝试同时使用MySQL Docker Container的私有IP和公共IP。

The point is that I am able to access MySQL Docker Container from outside Bluemix. 关键是我可以从Bluemix外部访问MySQL Docker容器。 So the IP, port, and MySQL itself are ok. 因此IP,端口和MySQL本身都可以。

It seems something related to the internal networking of Docker Container support within Bluemix. 似乎与Bluemix中Docker Container支持的内部网络有关。 If I try to access from inside Bluemix it fails, if I do from outside it works. 如果我尝试从Bluemix内部访问,则失败,如果我从外部进行访问,则工作正常。 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秒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM