“ java.net.NoRouteToHostException:主机没有路由”在两个Docker容器之间 [英] "java.net.NoRouteToHostException: No route to host" between two Docker Containers

查看:378
本文介绍了“ java.net.NoRouteToHostException:主机没有路由”在两个Docker容器之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:问题与Bluemix Docker支持有关。

Note: Question is related to Bluemix docker support.

我试图连接部署在Bluemix中的两个不同的Docker容器。我遇到了异常:

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

 java.net.NoRouteToHostException: No route to host

当我尝试进行这种连接时(在Liberty上运行的Java EE应用试图访问MySQL)。我尝试使用MySQL Docker Container的私有和公共IP。

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.

关键是我可以从Bluemix外部访问MySQL Docker Container。因此,IP,端口和MySQL本身都可以。

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

似乎与Bluemix中Docker Container支持的内部网络有关。如果尝试从Bluemix内部访问,则失败,如果我从外部进行访问,则工作正常。有帮助吗?

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?

更新:正如您在评论中看到的那样,我继续进行调查,这似乎是一个时间问题。我的意思是,一旦容器启动并运行,似乎仍有一些连接工作尚未完成。如果我能够等待1分钟左右,然后尝试进行连接即可。

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.

推荐答案

60秒应该是经验法则创建容器后开始联网。

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

这篇关于“ java.net.NoRouteToHostException:主机没有路由”在两个Docker容器之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆