Docker Community Forums

Share and learn in the Docker community.

DNS on mac work seamlessly


(Geoheil) #1

Expected behavior

Have DNS work seamlessly on mac so that containers can be accessed by name even on a non-native docker host

Actual behavior

ip of dockerhost is required

Information

Yesterday I installed the docker-beata (https://beta.docker.com/) for osx. So far it seems great but the links defined between containers still do not to work out of the box, e.g their respective DNS name does not seem to be resolved.

How can I change this to make the dns-name of the linked container available on the (osx/ windows)host using docker-beta?

links:
      - someName

Steps to reproduce the behavior

  1. install docker & compose
  2. start named containers via a compose file
  3. try to access them e.g. ping

(Scarlac) #2

I’m not having problems with hostnames if the containers are set up using docker-compose and we’re talking about inter-container network traffic. In some cases you may need to specify the internal docker DNS server which runs “hidden” at 127.0.0.11 inside the docker environment.

If you’re talking about exposing container network hostnames to the host, I’m not sure it’s possible. ie. you can run the same app twice without changing hostnames if you define separate networks or link them together. On your host OS you wouldn’t be able to distinguish between containers, only by port.


(Geoheil) #3

I could verify that I currently use the hostnet option. How would the solution here https://github.com/databricks/spark-integration-tests (adding a route) like > sudo route -n add 172.17.0.0/16 boot2docker ip work for the docker beta? Is nat mode strictly required for this?


(Scarlac) #4

I don’t know. Bridge mode is default AFAIK, where it’ll be available on that IP. But if you’re using host then my best guess would be that you’re on your own.


(Geoheil) #5

As docker for mac is now production ready I wonder how to tackle this issue. I still could not get it to work.


(Dave Scott) #6

As scarlac says, the usual way for the host to contact containers is through exposed ports-- for example see the example voting app’s docker-compose.yml. There’s no current built-in way for the host to see the container-internal IP or to see the container names as DNS entries. However it might be possible to set up something like a SOCKS proxy in a container, expose the port on the Mac and route traffic through it?