way docker swarm do reverse dns lookup in the host machine when we use overlay network to discover service

i found that if the nameserver is not configured for the host machine,the nsloop will very slow.
i want to know why.


1. remove nameserver

echo '' > /etc/resolv.conf

2. create network and service

docker network create -d overlay net --attachable=true
docker service create --name one --network net nginx:alpine

3. ping service one

[[email protected] ~]# docker run -it --network net centos:7
[[email protected] /]# time ping one -c 1
PING one (10.0.7.2) 56(84) bytes of data.
64 bytes from 10.0.7.2: icmp_seq=1 ttl=64 time=0.040 ms

--- one ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.040/0.040/0.040/0.000 ms

real    0m10.003s
user    0m0.003s
sys 0m0.000s

here, it take 10second to return.


tcpdump in my host machine

[[email protected] ~]# tcpdump port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
19:58:15.190538 IP ecs-db73.44666 > 8.8.8.8.domain: 11497+ PTR? 2.7.0.10.in-addr.arpa. (39)
19:58:19.190778 IP ecs-db73.36195 > 8.8.4.4.domain: 11497+ PTR? 2.7.0.10.in-addr.arpa. (39)
19:58:20.192448 IP ecs-db73.34135 > 8.8.8.8.domain: 11497+ PTR? 2.7.0.10.in-addr.arpa. (39)

my machine is not accessible 8.8.8.8 and 8.8.4.4,so the reverse dns lookup must be failure.
way docker swarm do reverse dns lookup in the host machine?

Source: StackOverflow