aacebedo / dnsdock

DNS service discovery for Docker containers
MIT License
606 stars 91 forks source link

com.dnsdock.ip_addr using a container name #102

Closed julianxhokaxhiu closed 7 years ago

julianxhokaxhiu commented 7 years ago

Hi,

I saw that via this label it is possible to override the IP of the DNS entry, by using for example the one from the reverse proxy in the network. This is very useful, although only when you set a static ip to the container.

Is it possible to create a label ( or re-use the existing one ) that fetches automatically the IP of the reverse proxy by using the reverse proxy container name? Something like

docker run --name my-reverse-proxy-container ...

docker run ... -l com.dnsdock.ip_addr=my-reverse-proxy-container ...

This would be very useful in order to enable full-autodiscovery without the need to map every IP here and there.

Thank you in advance, Julian

julianxhokaxhiu commented 7 years ago

For whoever may have this issue, if you bind the port 80/443 to 172.17.0.1 you can use it as a conventional IP for setting it up on any container. Eg.:

$ docker run -p 172.17.0.1:80:80 nginx

$ docker run -l com.dnsdock.ip_addr=172.17.0.1 --name my-awesome-docker ...

$ ping my-awesome-docker # 172.17.0.1

Issue solved :)