Docker Community Forums

Share and learn in the Docker community.

DNS resolution and reversed lookup


(Czechjiri) #1

deployed 6 hello-world containers

logged into hello-world-12d64fb9-1 and typed

nslookup hello-world-12d64fb9-6

nslookup: can't resolve '(null)': Name does not resolve                             
Name:      hello-world-12d64fb9-6                                               
Address 1: 10.7.0.20 ip-10-7-0-20.ec2.internal 

nslookup 10.7.0.20

nslookup: can't resolve '(null)': Name does not resolve                         
Name:      10.7.0.20                                                            
Address 1: 10.7.0.20 ip-10-7-0-20.ec2.internal         

then logged into hello-world-12d64fb9-6 and typed

hostname

 hello-world-12d64fb9-6

nslookup hello-world-12d64fb9-6

nslookup: can't resolve '(null)': Name does not resolve                                         
Name:      hello-world-12d64fb9-6                                               
Address 1: 172.17.0.7 hello-world-12d64fb9-6

is this how DNS resolution should work? seems really strange to me


(Fernando Mayo) #2

Resolving “hello-world-12d64fb9-6” from within “hello-world-12d64fb9-6” is giving you the bridge IP address. Resolving it from “hello-world-12d64fb9-1” is giving you the IP on the overlay network. The reverse name “ip-10-7-0-20.ec2.internal” is being given by AWS DNS server as it’s a private IP.


(Czechjiri) #3

The reverse name “ip-10-7-0-20.ec2.internal” is being given by AWS DNS server as it’s a private IP.

This is the part I am really confused about. This is not EC2 HOST ip/name (those run as 10.78.x.x) , this is container ip/name. Why is it getting assigned generic AWS name instead of the real container name? I am assuming its by design, but its really strange to me.


(Fernando Mayo) #4

As it’s a private IP, the query won’t reach our public DNS servers (where we perform service discovery resolutions) - the AWS DNS resolver will automatically answer that for all private IPs.