docker-mac-network icon indicating copy to clipboard operation
docker-mac-network copied to clipboard

Make Docker internal DNS name resolution service available to OSX through the VPN

Open dw-ec opened this issue 2 years ago • 1 comments

Using 4km3/dnsmasq it's possible to run a resolver that passes DNS queries through to Docker's internal name resolution service. This works for container names, as well as network alias names.

It would be really handy if the docker-mac-network ovpn server could push the DNS proxy container's IP as a resolver when the VPN is connected, allowing users to access their docker containers by name / hostname / alias, rather than by IP address.

I've got this working in a demo project but it requires manual editing of the .ovpn file before importing into tunnelblick.

dw-ec avatar Apr 21 '23 13:04 dw-ec

Overriding the system DNS settings is undesirable in most cases, but macOS does provide a mechanism to override resolution only for a specific domain or subdomain.

For example, you can create a /etc/resolver/example.com file with contents like:

nameserver 192.0.2.1

I would accept a PR that adds some kind of proxy DNS server that exposes the internal docker DNS and clearly documents how to create the local resolver file to access it.

wojas avatar Apr 25 '23 04:04 wojas