moby: Reverse hostname lookup fails in user-defined networks with embedded DNS server
Output of docker version:
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 21:37:01 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 21:37:01 2016
OS/Arch: linux/amd64
Output of docker info:
Containers: 10
Running: 8
Paused: 0
Stopped: 2
Images: 40
Server Version: 1.10.2
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 60
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
Volume: local
Network: null host bridge
Kernel Version: 3.13.0-24-generic
Operating System: Ubuntu 14.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 29.4 GiB
Name: myhostname.myemployer.com
ID: PO2A:QS2L:UA3R:FCYP:W452:DCSQ:OTGJ:EJSX:XYNI:RUTR:KAHK:NU35
WARNING: No swap limit support
Provide additional environment details (AWS, VirtualBox, physical, etc.): Have reproduced this on physical systems and AWS.
List the steps to reproduce the issue:
- Create a user-defined bridge network with
docker network create .... For this example, I called mine “blahnetwork.” - Start a Docker container in daemon mode, attaching it to the network, with /sbin/init. As an example:
docker run docker run -d --net=blahnetwork --net-alias=blah --hostname=blah centos:6.6 /sbin/init
This creates a container reachable within blahnetwork with the alias blah.
3. Use docker inspect to find out the IP address of this daemon container within blahnetwork. I got 192.168.124.6.
4. Test forward name resolution of containers in this network using the host utility:
docker run --net=blahnetwork centos:6.6 host blah
blah has address 192.168.124.6
Host blah not found: 3(NXDOMAIN)
Host blah not found: 3(NXDOMAIN)
- That worked. Now test reverse resolution:
docker run --net=blahnetwork centos:6.6 host 192.168.124.6
Host 6.124.168.192.in-addr.arpa. not found: 3(NXDOMAIN)
Describe the results you received: Using just the embedded Docker daemon’s DNS in 1.10, forward name resolution works great. Reverse name resolution fails, though.
Describe the results you expected: I’d expect reverse resolution to work. A simple workaround of specifying each container’s DNS server by passing the IP address of a separate daemon container running dnsmasq gives the expected behavior.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 19 (8 by maintainers)
Looks like the reverse DNS is appending the network name to the net alias (e.g.
my-containeronmy-networkreports asmy-container.my-networkinstead of justmy-container). 😦 That’s less than ideal.@dimaspivak
Looks like the trouble here comes from the fact that I'm not specifying a --name when running the container and relying on --net-alias insteadYour observation is correct. To give you the context, docker’s service discovery has always been based on container name passed via
--name. That is the reason why reverse mapping of IP points to --name.The
--net-aliasoption is relatively new, introduced in 1.10. If you have both --name and --net-alias you can see the reverse mapping of the IP points to the container name and not the alias. Since its a valid use case to pass --net-alias without --name it is indeed useful to have some reverse mapping available, may be to the one of the container’s aliases if --name is not available. We can make this change after confirming that it won’t cause any other issues.Just curious, are you using the reverse mapping just for debugging or have some other use for it ?