New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PiHole Docker doenst use correct DNS Servers (always defaults to googles) #505
Comments
I think you are getting confused by two different types of DNS settings. The --dns settings control which ip the container itself uses to resolve hostnames at the OS level. The DNS1 and DNS2 environment variables control which upstream resolvers pihole uses (the ones set in the web interface). So what you probably want to do is set --dns to 127.0.0.1 and then set DNS1 to 192.168.0.1 (and DNS2 to "no"). |
Yes, this is very confusing. 1.) Still my point is it doesnt save what ever i enter in the webpanel. (if i change the checkboxes it works, but i cant save a custom DNS server like 192.168.0.1) -- to clarify this, i can set the custom dns, and it works while its running, but after each gestart these settings get reset. This should be controllable via docker or am i wrong? 2.) what about the errors in the log, shouldnt the docker image be perfect?
3.) what is the correct way for OS dns? Should i seperate this out of my LAN? Like --dns=127.0.01 and --dns=8.8.8.8 or should i set the second dns also to my LAN dns 192.168.0.1 - i guess it doesnt matter and safer would be 8.8.8.8 Okay, just to be sure i redid everything.
|
It is docker's job to manage /etc/resolv.conf DNS. Sorry that is not really in my control when they fail to manage the resolv.conf. It seems more like a bug in the docker service on certain OS/hardware. Others have found a work around is taking over management of /etc/resolv.conf them selves (with a docker volume file mount) to resolve this issue. |
It happend again. I didnt touched anything since last time. Only thing i can think of is that it got updated and or backuped (i use CA Plugins on unraid for it). Im not sure what exactly you guys need to check it. Please tell me. I try my best. Thats the latest log:
Thats the latest log from unraid regrading pihole: Sep 23 06:19:27 Unraid-Server Docker Auto Update: Installing Updates for Netdata pihole (many of them, for every docker update, it gets checked every day) [✓] Your debug token is: https://tricorder.pi-hole.net/wqimavxk15 I think the problem is, it doesnt save the DNS i entered after update, could that be the problem??? |
Did you ever add the DNS1 and DNS2 environment variables like I mentioned above? So your complete argument string should be: " -e WEBPASSWORD= -v /mnt/user/appdata/pihole:/etc/pihole --cap-add=NET_ADMIN --dns=127.0.0.1 --dns=8.8.8.8 --env DNS1=192.168.0.1 --env DNS2="no" --restart=unless-stopped " I'm not sure if you need the quotes on the "no" for DNS2 or not. |
LoL, sorry, i didnt read that. I tried it and it seems to work, MANY thanks. Ill report back if i have again issues. THANKS. :-) DNS2="no" did the trick. Just btw, its still confusing, SHOULDNT the docker container KEEEP settings while getting updated??? Like my Lists are also saved (?) -- even without docker arguments? |
Is the dns setting in the docker-compose file not supposed to set the Pi-hole DNS? I am also experiencing it defaulting to Google. |
Look at my command! There are 2 different, nearly the same, commands. (thats not very clever, btw) |
How does that work for docker-compose though? |
You just need to add "DNS1" and "DNS2" environment variables in the docker-compose file. |
see my post from a few weeks ago. Seems not to work for me. |
@wrosenauer Are you mapping your pihole config to your local drive? If so I'm not sure which will take precedence - the environment variables in docker-compose or the dns servers configured in setupVars.conf. If you have mapped it, take a look at the setupVars.conf file there and see what is defined under "PIHOLE_DNS_1" and "PIHOLE_DNS_2". If it is configured for Google DNS, change them to your preferred servers and try restarting the container. This is just a shot in the dark without knowing more about your setup. |
Regarding the confusion of the environment DNS variable and the docker DNS argument, I was considering changing the environment to match the internal setupVars.conf value of PIHOLE_DNS_* to make it clearer one is docker's and one is Pi-hole's |
What ever you do, if its not nearly the same, it will be better. :) I would call it "systemdns" "upstreamdns1 "upstreamdns2" - its more to write, but 100% clear. I still wonder why your docker does not save setting set inside it (like the DNS settings) - if that is not possible, you should write that somewhere in the UI. |
I‘ve got the same problem with pi hole in Docker. |
The DNS settings are persisted to /etc/pihole/setupVars.conf. The settings persist after the container is removed. However, when the container starts up again, it overwrites the file. If I'm reading the code correctly, we scrub setupVars.conf here: docker-pi-hole/bash_functions.sh Line 83 in 49ed8a0
Then we regenerate the DNS settings here: docker-pi-hole/bash_functions.sh Line 133 in 49ed8a0
|
i have the same issue, any ETA on this bugfix ? |
Hi, PiHole didn't get that, and reseted all DNS Settings to default, but everything else works like before the upgrade ... I looked into the docker logs but I couldn't find anything interesting ... Google was also no help, so I hope somebody here know's what is wrong?? Can anyone explain to me what I did wrong? Greets Daniel |
Can confirm this is still an issue. Is this intended behavior? |
Same here, this is a huge issue -- especially if you want to prevent DNS leaks while using a VPN and blindly rely on Pi-hole just working as expected. |
To be clear: the current workaround is to set the |
Yes, that works. But this is still not good default behavior. |
Agreed. |
Isn't this simply a matter of checking here if the EDIT: Ah no, you guys check already if it exists. You would have to basically merge the existing |
Same issue as here: #604 |
Same in #719 |
Closed in place of the pinned #720 |
In raising this issue, I confirm the following:
{please fill the checkboxes, e.g: [X]}
How familiar are you with the the source code relevant to this issue?:
1
Expected behaviour:
I can change the dns servers in pi like i want
Actual behaviour:
It defaults to googles dns always (after each restart)
Steps to reproduce:
1. install docker pihole/pihole:latest 2. in the webinterface change the dns like u want and save it now works until you restart the docker 3. Until this its a expected behaivor, but if you now use --dns=192.168.0.1, it also dont get used, thats the bug 4. i expect that pihole uses the dns provided via --dns or atleast save the dns i set in the webinterface
Debug token provided by uploading
pihole -d
log:https://tricorder.pi-hole.net/4hiw4kakmh
Troubleshooting undertaken, and/or other relevant information:
{Steps of what you have done to fix this}
Ive posted on reddit before, but didnt got any help, so ill guess its a bug.
It should use the dns provided via --dns ?
Im using "pihole/pihole:latest https://hub.docker.com/r/pihole/pihole/"
With the following argument " -e WEBPASSWORD= -v /mnt/user/appdata/pihole:/etc/pihole --cap-add=NET_ADMIN --dns=127.0.0.1 --dns=192.168.0.1 --restart=unless-stopped "
Problem is it doesnt use 192.168.0.1, what i change inside the webinterface of pihole gets complete removed after each restart. So i dont see a way to use your own dns server!?
Why is he sayin "WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server"
Is this also a bug in the pihole docker!?
The text was updated successfully, but these errors were encountered: