Docker for mac cannot resolved domain from /etc/hosts

Expected behavior

resolved domain from /etc/hosts

Actual behavior

cannot resolved domain from /etc/hosts

Information

I add a domain record which exist in public DNS server to /etc/hosts file and point to a local IP what the private registery used.
But when I push image to the domain, It aways point to the public DNS.

  • host distribution and version OSX 10.11.x
2 Likes

This affects me as well, but a little differently. I have a registry on my LAN that isn’t publicly addressable, so I add the host name to /etc/hosts. In docker-machine that works, but not in Docker for Mac.

Did you find a workaround (something simpler than running your own dns server) on the problem? Likewise I can’t pull images from a host on an intranet that I’ve got a setting for in /etc/hosts, but is not available on the vpn’s dns server. If I change docker pull to using an ip address instead of the host name – problem goes away. Docker pull/push should be respecting hte local OSX host’s /etc/hosts file.

  • Brian

Do as follow:

    screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
    username:root
    password:[empty]
    close session:`Ctrl+a d`

   vi /etc/hosts
   service docker restart