gliderlabs / registrator

Service registry bridge for Docker with pluggable adapters
http://gliderlabs.com/registrator
MIT License
4.66k stars 912 forks source link

Registrator doesn't respect /etc/resolv.conf #269

Open ghost opened 9 years ago

ghost commented 9 years ago

I'm attempting to utilise registrator in AWS for service discovery however I've noted that the IP used to register services is set to 0.0.0.0. AWS automatically sets the hostname of the instance to a variation based off the private ip address (e.g. ip-10-0-255-5) and therefore it should be resolvable.

It appears either go or alpine aren't respecting the configuration in /etc/resolv.conf Running the same ping command against the stock debian:jessie container works.

Pinging ip-10-0-255-5

docker exec -it registrator ping ip-10-0-255-5
ping: bad address 'ip-10-0-255-5'

Checking /etc/resolv.conf

ubuntu@ip-10-0-255-5:~$ docker exec -it registrator cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.0.0.2
search eu-west-1.compute.internal

docker-compose.yml

registrator:
  container_name: registrator
  image: gliderlabs/registrator
  command: -resync 15 consul://localhost:8500
  net: host
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock
  restart: always
ghost commented 9 years ago

Appears to be a known caveat as per the base image. https://github.com/gliderlabs/docker-alpine/blob/master/docs/caveats.md

It would be good to see the project being released with different images (e.g. alpine, debian, ubuntu)