Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker embedded DNS server #219

Closed
kooba opened this issue Dec 5, 2016 · 3 comments
Closed

Docker embedded DNS server #219

kooba opened this issue Dec 5, 2016 · 3 comments

Comments

@kooba
Copy link

kooba commented Dec 5, 2016

I'm having issue with docker container name resolution when using dnspython. Issue seems to be only there when search is set in /etc/resolv.conf

Docker embedded DNS server allows unlinked containers to be resolved just by their name.

I've created gist that can be used to reproduce the problem:
https://gist.github.com/kooba/c464f7e33056cb0ad37edcbe43bb0da0

This can be run with docker-compose up

Expected results in stdout are:

### socket example ###
172.19.0.2
### dnspython example ###
172.19.0.2

getting:

### socket example ###
172.19.0.2
### dnspython example ###
Traceback (most recent call last):
  File "/var/tmp/test.py", line 19, in <module>
    answers = resolver.query(service_url)
  File "/usr/local/lib/python3.4/site-packages/dns/resolver.py", line 1051, in query
    raise NXDOMAIN(qnames=qnames_to_try, responses=nxdomain_responses)
dns.resolver.NXDOMAIN: The DNS query name does not exist: test-service.foo.example.com.

Any help would be greatly appreciated.

@MartinBasti
Copy link
Contributor

Hello, what do you have in /etc/resolv.conf? dnspython asks directly DNS servers listed there, could you please check first with using dig command if test-service.foo.example.com. is resolvable?

Socket uses configuration from /etc/nsswitch.conf, i.e. host files, dns, myhostname, etc..

@kooba
Copy link
Author

kooba commented Dec 9, 2016

Hi /etc/resolv.conf is:

search foo.example.com
nameserver 127.0.0.11
options ndots:0

test-service.foo.example.com is not resolvable but I expected that test-service will be first looked up in 127.0.0.11 which would resolve it. I guess test-service is not treated as fully qualified domain and search is used instead?

The workaround I was able to implement was to add . after the url so test-service. would be treated as a fully qualified domain. That fixed it. Just not sure if that's desired behaviour.

@rthalley
Copy link
Owner

rthalley commented Dec 9, 2016

That's the normal desired behavior when there is a search list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants