inviqa / dock-cli

Dock CLI
MIT License
39 stars 14 forks source link

DNS resolution whilst building containers fails quite often #130

Open kierenevans opened 7 years ago

kierenevans commented 7 years ago

https://github.com/inviqa/dock-cli/blob/736ed188bd3940230fe0a1f65dd380583741df5d/src/Installer/DNS/Mac/DnsDock.php#L101

The above --dns flag leads to a lot of failures in DNS resolution when building or upping containers, for example @rocketage had the following error recently:

  [Composer\Downloader\TransportException]
  The "https://packages.firegento.com/packages.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
  failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

and I have had very similar issues.

We could potentially rely on the virtualbox DNS resolver which will defer to the host's configuration.

Since removing the --dns flag locally, my DNS issues have stopped occurring.

sroze commented 7 years ago

That means that Docker would use the VM's DNS name resolver, that means that we won't be able to resolve .docker DNS names inside the containers. We should probably run a quick investigation about their usage but I know that I personally use them heavily in micro-services projects...

kierenevans commented 7 years ago

The dockerd --help documentation implies multiple DNS flags (or an array) are allowed:

  --dns=[]                                 DNS server to use
  --dns-opt=[]                             DNS options to use
  --dns-search=[]                          DNS search domains to use

The issue we have seen is dnsdock crashing when failing to look up addresses, so then subsequently non *.docker addresses also fail to be looked up.

A way around this would be to set up multiple DNS IPs, which I'll look into soon.

sroze commented 7 years ago

@kierenevans I'll looking forward your updated PR to use multiple DNSs 😛

kierenevans commented 7 years ago

All in good time, my friend :)

sroze commented 7 years ago

@kierenevans anything about that? 💃