aacebedo / dnsdock

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

Unable to set IP address using docker labels #106

Open wazzaguy opened 5 years ago

wazzaguy commented 5 years ago

I can't seem to set custom ip addresses using labels and through curl -X PATCH

Has dnsdock been abondond ? and if so is there an alternative?

aacebedo commented 5 years ago

Hi.

I'll try to look to your issues dns others asap. I also want to update all dependencies of dnsdock and try to keep it up to date more than the last months. Can you give me a use case a little more detailed so I'll be able to reproduce the issue. Regards.

wazzaguy commented 5 years ago

I created the dockdns as such: docker run -d --name dockdns -v /var/run/docker.sock:/var/run/docker.sock -p 192.168.2.60:53:53/udp -p 50080:80 tonistiigi/dnsdock:latest --verbose

I have a test container called: 'wazztest'

I set a label on the container and looked at the output of dnsdock it showed the following: Added service: a3ad061840ac80f68bcb7f24b01b88df515236cef56c1c59c065e270b8d718a2 {wazztest wjg-alpine 172.17.0.2 -1 []}

docker inspect showed the label was there: "Config": { "Labels": { "com.dnsdock.ip_addr": "192.168.2.60" } },

I tried to PATCH directly using curl: curl http://192.168.2.60:50080/services/abe6b44181aa13b364f4d22743eb00c0d9f94f8be31fe3ba961b92397760a6b5 -X PATCH --data-ascii '{"ip": "192.168.2.60","ttl": 0}'

and I checked if it changed but it hadn't: curl http://192.168.2.60:50080/services/abe6b44181aa13b364f4d22743eb00c0d9f94f8be31fe3ba961b92397760a6b5

response: {"Name":"wazztest","Image":"wjg-alpine","Ip":"172.17.0.2","Ttl":0,"Aliases":[]}

I can however change the TTL using curl but I can't using the com.docker.ttl label.

wazzaguy commented 5 years ago

My use case is to supliment my internal dns router which has A records pointing mainly to a reverse proxy with the exception of a couple of docker containers within a swarm.

Everytime I create a new website within the reverse proxy I then have to define an A record on my router to point it to my reverse proxies internal IP.

I'd like to instead define a preferred DNS to DNSDOCK's ip address and have it return the A record host ip I define within a label.

psyciknz commented 2 years ago

My use case is to supliment my internal dns router which has A records pointing mainly to a reverse proxy with the exception of a couple of docker containers within a swarm.

Everytime I create a new website within the reverse proxy I then have to define an A record on my router to point it to my reverse proxies internal IP.

I'd like to instead define a preferred DNS to DNSDOCK's ip address and have it return the A record host ip I define within a label.

Long time ago, i know, but did you ever get this working? I’m facing exactly the same thing. I want to specify a container and the location of a reverse proxy sever via labels so that I don’t have to manually update my routers dns