简体   繁体   English

boot2docker无法访问外部世界

[英]boot2docker can't access the outside world

On OSX, through boot2docker, I have a ruby on rails app running in a docker container. 在OSX上,通过boot2docker,我在docker容器中运行了ruby on rails应用程序。

However, it can't seem to access third party API's. 但是,它似乎无法访问第三方API。

The code below works outside of a docker container, but not inside: 下面的代码在docker容器外部起作用,但在内部不起作用:

response = HTTParty.get('https://api.stackexchange.com/2.2/questions?site=stackoverflow')

When run from inside a docker container the request timeouts with: 从Docker容器内部运行时,请求超时包括:

SocketError: getaddrinfo: Name or service not known

At this point I think the problem might be with the boot2docker setup, as if do: 在这一点上,我认为问题可能出在boot2docker设置上,就像这样做:

boot2docker ssh
ping stackexchange.com

then it timeouts. 然后超时。

I am using OSX 10.10.3, boot2docker 1.50, and docker-compose 我正在使用OSX 10.10.3,boot2docker 1.50和docker-compose

After more digging I found an issue on Github, installing boot2docker via brew was the problem. 经过更多挖掘之后,我在Github上发现了一个问题,就是通过brew安装boot2docker才是问题所在。

I uninstalled, via brew, rebooted and installed directly from http://boot2docker.io/ . 我通过brew卸载了,然后直接从http://boot2docker.io/重新启动并安装了。 This appears to have fixed the problem. 这似乎已经解决了问题。

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

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