gliderlabs / resolvable

Host-level DNS gateway for Docker
MIT License
315 stars 37 forks source link

resolve PTR query (reverse lookup) to FQDN #22

Open lalyos opened 8 years ago

lalyos commented 8 years ago

Reverse lookups shoud probably resolve to the hostname, where the domain is included.

lalyos commented 8 years ago

You can test this PR applied to resolvable as lalyos/resolvable:fqdn-ptr

$ docker run -d \
    --hostname resolvable \
    -v /var/run/docker.sock:/tmp/docker.sock \
    -v /etc/resolv.conf:/tmp/resolv.conf \
    lalyos/resolvable:fqdn-ptr

and than start a fqdn container:

$ docker run -it --hostname=myhost.example.com  gliderlabs/alpine:3.3 sh                                                                                       
# apk add -U bind-tools

# dig +short myhost.example.com
172.17.0.3

# dig +short -x 172.17.0.3
myhost.example.com.
tilgovi commented 8 years ago

Only question I have is whether it's possible that the container domain name is empty, and then does the trailing . break anything?

Other than that, seems fine to me, although I admit I don't understand why this makes PTR work :).

lalyos commented 8 years ago

reverse lookups (PTR records) is already working, it just resoles to the short name. This PR is about resolving reverse lookups to fqdn instead of short hostname.

So right nowit works like this:

# dig +short myhost
172.17.0.3

# dig +short -x 172.17.0.3
myhost.

The trailing dot is actually how PTR-s are working, so it doesnt break anything.

tilgovi commented 8 years ago

This works great for me. Tested with --name (the .docker alias works unchanged) and --hostname with short and fqdn.

tilgovi commented 8 years ago

@progrium?