-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Passing quoted list to PIHOLE_DNS_ via docker-compose environment will break startup #838
Comments
@dschaper I think we can modify the if side of the block like this:
Thoughts on that? I'm happy to PR it, but I'm not exactly a bash expert either. |
@PromoFaux that's a great question. I was single-quoting based off the existing example for TZ that's in the README:
|
Ah yes, sure, but note that that is I'm just reading up to see if there is an expected way to do it. |
Promo: It's down to YAML, and really there should be no quotes. But there's two things that I think are being conflated.
So what happens is:
is passed in to the environment exactly as written. Same as if you were to type: PIHOLE_DNS_='1.2.3.4;4.3.2.1' at the shell prompt. A better test would be to set the different styles of |
So, there doesn't seem to be a single way to do it, in a lot of places I'm seeing the following:
But I'm never seeing anywhere where quotes are used on the right hand side of an (I wrote this just before Dan replied, but I'm hitting comment anyway) |
Sorry, please substitute |
Now, apparently https://docs.docker.com/compose/compose-file/compose-file-v3/#environment |
ffs. I was looking at that exact page and skimmed right past that section! But that is pretty clear, I think. @kylekurz, what you're seeing is expected, if you use one of the correct ways of defining the variables, the issue will go away. That all said, there is some merit in us using the already sourced which, in the case of your example would look like: container would still be operational because it would fall back to default PR incoming... |
@PromoFaux @dschaper thanks for digging in on that. I’ll update my files to do it “right”. That said, I’m a little concerned about falling back instead of failing. If I’m specifying my DNS to this tool that is all focused on helping with my privacy, falling back to Google DNS instead strikes me as anathema. Should we just continue to let it fail if the input doesn’t parse correctly? |
To reduce the barrier to entry - out of the box we need to provide something. Google is to one person what Microsoft is to another - we could wax lyrical about which companies = bad to have any of your data all day long, but ultimately it is down to the user to ensure they've configured it correctly if they want it to behave in a specific way. TL;DR - it has to do something out of the box, or less experienced people will shrug it off as a product that doesn't work. Google just happens to be the DNS provider that was set as the default for no other reason than in 2016 that was the first one that came to mind. AGAIN though, that all said I can see some merit, perhaps, in a simple check to the number of valid entries passed in through |
@PromoFaux point taken. I think the difference is “nothing provided” vs “bad info provided”. My vote would be default to what you want (Google is fine), but crash if the user config is wrong and force them to fix it. Thanks again for discussing with me and letting me contribute! |
I've added commit to my PR to hard crash if the And no problem, it's good to hear different ideas on things - sometimes we can get too close to the code and not see the issues as clearly as a fresh set of eyes. I've lost count of the amount of mistakes I made (and still make!!) when I started contributing to Pi-hole 6 years ago.... ('kinell, where has the time gone??), I've learned to just roll with it ;) |
Apparently breaks working old config with:
(which is my cloudflared on an internal docker network)
|
Per the discussion above, you're actually defining the environment variable incorrectly. it should be either:
Some additional code has been added to ensure that the values passed through are valid, and the way you are passing it through is also bringing through the quotes, which is not valid. Secondly, per the Readme, you should be using the |
Well I used to configure like the recommendation on https://hub.docker.com/r/pihole/pihole And apparently my config did work for quite a long time. Needs to be updated i think. |
Actually there are some changes to the Readme on this repo that need to go up to docker hub (i'll do that in about 10 mins) but please point out where it says on docker hub to set the environment like |
I've updated it. Sorry, didn't mean to be combative in my last. The
I guess you were lucky that it worked before, but the point is that environment variables are expected to be passed in a very limited number of ways https://docs.docker.com/compose/compose-file/compose-file-v3/#environment |
This is a: Bug
Details
If you pass in a single DNS entry with quotes around it:
- PIHOLE_DNS_='1.1.1.1'
, that works. If you pass in a list, it doesn't, as '- PIHOLE_DNS_='1.1.1.1;1.0.0.1'` yields:and the pihole container will exit.
My proposal is to remove all single and double-quotes before splitting the array, so that we're left with a value on $PIHOLE_DNS_ that is
1.1.1.1;1.0.0.1
in the example above. Once the string is cleaned up, the rest of the parsing can continue as it previously has. Note, this does not seem to be an issue with the raw docker run CLI, I'm only seeing it via compose files.Related Issues
See discussion on #816 for more details.
These common fixes didn't work for my issue
docker run
example(s) in the readme (removing any customizations I added)If the above debugging / fixes revealed any new information note it here.
Add any other debugging steps you've taken or theories on root cause that may help.
The text was updated successfully, but these errors were encountered: