Search code examples
rubynetwork-programmingdockerboot2dockerdocker-compose

boot2docker can't access the outside world


On OSX, through boot2docker, I have a ruby on rails app running in a docker container.

However, it can't seem to access third party API's.

The code below works outside of a docker container, but not inside:

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

When run from inside a docker container the request timeouts with:

SocketError: getaddrinfo: Name or service not known

At this point I think the problem might be with the boot2docker setup, as if do:

boot2docker ssh
ping stackexchange.com

then it timeouts.

I am using OSX 10.10.3, boot2docker 1.50, and docker-compose


Solution

  • After more digging I found an issue on Github, installing boot2docker via brew was the problem.

    I uninstalled, via brew, rebooted and installed directly from http://boot2docker.io/ . This appears to have fixed the problem.