Search code examples
dockerboot2docker

Connecting from a docker container to the host?


I'm on OSX using boot2docker. There's a redis server running on the OSX host on port 6379 and I'd like to access it from inside the container.

However:
docker@boot2docker:~$ telnet 172.17.42.1 6379 telnet: can't connect to remote host (172.17.42.1): Connection refused

How do I expose the host port 6379 to the container?


Solution

  • I answered a similar question here. You can either run your container with --add-host as mentioned or you might also be able to use your local Mac's dns name directly.