Connection to ip of docker hosts fails from inside a container on the same docker host

I’m running a BIND9 container on coreos. Everything works as expected, that is, almost everything :slight_smile: I can resolv on to exposed port 53 on the ip address of coreos (docker host) from anywhere in my network.

For example:
On any host in my network I have 10.0.2.31 as ip for the DNS. I can use it as expected. 10.0.2.31 is the ip of the docker host where my bind9 container is running

But when I do resolving from containers on the SAME coreos host (10.0.2.31) it does not work as expected.
It only works if I use the docker0 ip (172.17.0.1) as ip for the DNS server. So logging below.

For example
So from another container on the same coreos docker host, entered with docker exec -it bash.
so 10.0.2.31 is the IP of the docker host where multiple containers are running.

nslookup

server 10.0.2.31
Default server: 10.0.2.31
Address: 10.0.2.31#53
10.0.2.100
;; reply from unexpected source: 172.17.0.1#53, expected 10.0.2.31#53
;; reply from unexpected source: 172.17.0.1#53, expected 10.0.2.31#53
;; reply from unexpected source: 172.17.0.1#53, expected 10.0.2.31#53
;; connection timed out; no servers could be reached
server 172.17.0.1
Default server: 172.17.0.1
Address: 172.17.0.1#53
10.0.2.100
Server: 172.17.0.1
Address: 172.17.0.1#53

100.2.0.10.in-addr.arpa name = example_name.domain.com

What is wrong with my setup?