aacebedo / dnsdock

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

--nameserver will not keep le service dnsdock runing in "docker ps" in the version 1.16.* #90

Closed sawyerlin closed 7 years ago

sawyerlin commented 7 years ago

Hello,

I have tried two versions of dnsdock 1.15. and 1.16.

I want to use --nameserver option to redirect some request to a private network. with 1.15., it works well but with 1.16., the service stopped right away after it is started.

aacebedo commented 7 years ago

Hi

Can you start dnsdock with the verbose option and copy the result here.

christian-comsolit commented 7 years ago

Hi, i have the same issue - the container shuts down after this error message: 18.1.2017 12:19:1211:19:12.376 | CRITICAL ▶ DNS fowarding for 'read udp 172.17.42.15:35526->172.23.56.1:53: i/o timeout' failed: no more nameservers to try

koddo commented 7 years ago

@aacebedo, here is the line where it goes down: https://github.com/aacebedo/dnsdock/blob/a8f97e6b4ffaddcfe652eaa98b42fe2095e12439/src/servers/dnsserver.go#L196

This is because logger.Fatalf() calls os.Exit(1): https://golang.org/pkg/log/#Fatalf

aacebedo commented 7 years ago

Hi ! Thanks for the feedback. The logger is not the issue as I don't use the standard but q third party lib However I think the err variable may be nil leading to a segfault

koddo commented 7 years ago

Do you use https://github.com/op/go-logging? It seems like Fatalf() from it does call os.Exit(1) too: https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/logger.go#L180

rothvaw commented 7 years ago

Hi! I have exactly the same issue. The container with dnsdock shuts down when communication to the all forwarding DNS (in my case only one from Google) is not reachable, when for example host system disconnects from the WiFi router. 10:41:10.167 | DEBUG ▶ Using DNS forwarding for 'bqgfsvygfybyf.' 10:41:10.167 | DEBUG ▶ Forwarding DNS nameservers: 8.8.8.8:53 10:41:10.167 | DEBUG ▶ Using Nameserver 8.8.8.8:53 10:41:11.165 | CRITICAL ▶ DNS fowarding for 'read udp 172.18.0.100:38846->8.8.8.8:53: i/o timeout' failed: no more nameservers to try

koddo commented 7 years ago

@rothvaw, it's still usable when you run it with --restart on-failure flag:

#!/usr/bin/env bash

docker run -d \
       -v /var/run/docker.sock:/var/run/docker.sock \
       --name dnsdock -p 172.17.0.1:53:53/udp \
       --restart on-failure \
       aacebedo/dnsdock:latest-amd64 --domain dnsdock --environment dev        # --verbose
koddo commented 7 years ago

I mean, usable and awesome. Works great in development environment.

rothvaw commented 7 years ago

@koddo thanks for workaround, but in my case I also add some entries to the dnsdock by http api and when dnsdock restarts those entries are not present anymore, I must to add them once again. Maybe there is an option to save entries by mounting some volumes?

aacebedo commented 7 years ago

Hi I am trying to release a corrected version this weekend. I am struggling with another issue on the resolution side. I think I'll pause it to fix this issue in priority

aacebedo commented 7 years ago

Hi ! This issue shall be solved with version 1.16.3 :)

Sorry for the delay.

rothvaw commented 7 years ago

Hi! I confirmed, it's working in 1.16.3. The dnsdock is stable even if the connection to all forwarding DNS servers is not possible. In this case there is only a warning in logs, instead of shutdown (like was in 1.16.1):

07:44:15.828 | DEBUG ▶ Using Nameserver 8.8.8.8:53
07:44:17.144 | WARNING ▶ DNS fowarding failed: no more nameservers to try

Thank You very much!

aacebedo commented 7 years ago

You're welcome :)