gliderlabs / resolvable

Host-level DNS gateway for Docker
MIT License
315 stars 37 forks source link

Unable to use dns search #10

Closed JeanMertz closed 9 years ago

JeanMertz commented 9 years ago

I seem to be unable to use the DNS_RESOLVES variable to use the "dns search" functionality of resolvable.

After starting resolvable, this is the output I get:

resolvable_1 | 2015/07/18 20:35:11 systemd: disabled, cannot read /tmp/systemd: stat /tmp/systemd: no such file or directory
resolvable_1 | 2015/07/18 20:35:11 Starting resolvable 0.2 ...
resolvable_1 | 2015/07/18 20:35:11 got local address: 172.17.42.207
resolvable_1 | 2015/07/18 20:35:11 updating resolv.conf: /tmp/resolv.conf

Resolvable starts after the Consul container, which has -e DNS_RESOLVES=consul set. If I start a third container, and enter it, I can see the following:

% cat /etc/hosts
172.17.42.217   f0ca83d2d315
127.0.0.1   localhost
172.17.42.208   consul 9c4e27c17d50 dev_consul_1
172.17.42.208   consul_1 9c4e27c17d50 dev_consul_1
172.17.42.208   dev_consul_1 9c4e27c17d50
172.17.42.212   dev_registrator_1
172.17.42.212   dev_registrator_1.bridge
172.17.42.217   dev_r_run_1.bridge
172.17.42.207   dev_resolvable_1
172.17.42.217   dev_r_run_1
172.17.42.207   dev_resolvable_1.bridge
172.17.42.208   dev_consul_1
172.17.42.208   dev_consul_1.bridge
% cat /etc/resolv.conf 
nameserver 172.17.42.207 # added by resolvable
% ping consul.service.consul
PING consul.service.consul (172.17.42.208): 56 data bytes
% ping consul.service
ping: bad address 'consul.service'

Note: I was redirected to this tool from https://github.com/gliderlabs/docker-alpine/issues/8. I already had DNS querying solved using the FQDN, but I was hoping the use of resolvable would help me use dns search to simplify the domains.

JeanMertz commented 9 years ago

After thinking about this some more, I might have misinterpreted the use of DNS_RESOLVES. I believe this is only used to let resolvable know which DNS service to use for which domains, which has little to do with the dns search capabilities.

Having said that, is there anything resolvable can do to make the dns searching work, when using an OS based on musl, which does not support the search directive in resolv.conf?

mgood commented 9 years ago

Yeah, that's right. The DNS_RESOLVES just registers that container to send queries for the given domains, but it's not using it as a DNS "search" domain.

We've talked about search support like you mention, so you could open a ticket for that feature. It should be possible for resolvable to parse "search" statements from resolv.conf at startup and then use that for queries.