docker-pi-hole
docker-pi-hole copied to clipboard
Removal of `/s6-init` breaks `entrypoint` overrides
Versions
Core version is v6.0 (Latest: v6.0) Web version is v6.0 (Latest: v6.0) FTL version is v6.0 (Latest: v6.0)
Platform
- OS and version: Debian GNU/Linux 11
- Platform: Docker
Expected behavior
Anybody with old entrypoint overrides will be calling /s6-init as the last command to allow the container to continue to start as intended, ie:
entrypoint: |
/bin/sh -c
"echo 'server=/61.10.in-addr.arpa./127.0.0.1#953' > /etc/dnsmasq.d/02-custom.conf &&
echo 'server=/an.example.invalid./127.0.0.1#953' >> /etc/dnsmasq.d/02-custom.conf &&
echo 'server=/another.example.invalid./127.0.0.1#953' >> /etc/dnsmasq.d/02-custom.conf &&
echo 'server=/yet.another.example.invalid./127.0.0.1#953' >> /etc/dnsmasq.d/02-custom.conf &&
exec /s6-init"
Actual behavior / bug
Without the former startup file, pihole keeps restarting.
Steps to reproduce
Steps to reproduce the behavior:
- Override entrypoint on container
- Start container
Debug Token
- URL: N/A
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I can't see anything announced that the startup entrypoint was changing, but using the new entrypoint resolves the issue.
To resolve this issue, use start.sh
entrypoint: |
/bin/sh -c
"echo 'server=/61.10.in-addr.arpa./127.0.0.1#953' > /etc/dnsmasq.d/02-custom.conf &&
echo 'server=/an.example.invalid./127.0.0.1#953' >> /etc/dnsmasq.d/02-custom.conf &&
echo 'server=/another.example.invalid./127.0.0.1#953' >> /etc/dnsmasq.d/02-custom.conf &&
echo 'server=/yet.another.example.invalid./127.0.0.1#953' >> /etc/dnsmasq.d/02-custom.conf &&
exec /usr/bin/start.sh"
Yes, this isn't the greatest hack - but there's no way to persist minor config settings like this without shared volumes, so creating this file on startup is the only real solution.
Thanks, I'll leave this open in case someone else has a similar issue - though I'm not sure how many folk were doing this.
Interesting way around an issue, though. Any reason why you're not just using a volume mount for /etc/dnsmasq.d?
An alternative solution for you, as i've just learned about the existence of this config option
Setting via the web interface stores it in the config file like so:
dnsmasq_lines = [
"server=/61.10.in-addr.arpa./127.0.0.1#953",
"server=/an.example.invalid./127.0.0.1#953"
] ### CHANGED, default = []
This could also be set by the environment variable FTLCONF_misc_dnsmasq_lines, although I'm currently struggling to get a value to stick when setting it this way. @DL6ER What is the correct format to pass this in via the environment?
@PromoFaux have you tried that - because the "=" breaks it.
I spent hours on it this morning trying every possible combo, and I can't get "FTLCONF_misc_dnsmasq_lines" to add anything other than [server, server, "server, 'server
Thanks, I'll leave this open in case someone else has a similar issue - though I'm not sure how many folk were doing this.
Interesting way around an issue, though. Any reason why you're not just using a volume mount for /etc/dnsmasq.d?
It's "permanent" (in this environment) and the VM's that run pihole only have ephemeral storage, so, rather than giving it a gluster volume for that tiny little file - I have been creating it on start.
FTLCONF_misc_dnsmasq_lines would be an awesome fix for our hack, but the equals in the string breaks the parsing, so I can't put lines like server=1.2.3 in it.
have you tried that - because the "=" breaks it.
Yeah, sorry - that's what I meant by:
, although I'm currently struggling to get a value to stick when setting it this way
FTLCONF_misc_dnsmasq_lines would be an awesome fix
Lets see what DL comes back with...
have you tried that - because the "=" breaks it.
Yeah, sorry - that's what I meant by:
, although I'm currently struggling to get a value to stick when setting it this way
AH! Sorry!
Yeah - I've tried (what I think is?) every possible iteration of single, double quotes, list/sequence, mapping - I just can't get anything past the "="
The value is passed to the container.
Inside the container there will be a variable with the value, like:
FTLCONF_misc_dnsmasq_lines=server=/61.10.in-addr.arpa./127.0.0.1#953;server=/an.example.invalid./127.0.0.1#953
But FTL is not correctly parsing values with = and only the initial part (before the equal sign) is written in the file.
But FTL is not correctly parsing values with = and only the initial part (before the equal sign) is written in the file.
@rdwebdesign Do you want me to create a new ticket for that?
No need for another issue. I was just explaining the results of my tests.
We are aware of the issue and we will fix it when we have the time to dig into the code. Just be patient.
Just be patient
@rdwebdesign appreciate it - thank you. No urgency needed - the workaround is fine.
This is an FTL issue somewhere around https://github.com/pi-hole/FTL/blob/eaa7dbb4cf4316413558c9d4b4e3f2a44f8e8203/src/config/env.c#L53-L58
Fix for the env setting at https://github.com/pi-hole/FTL/pull/2204
Same issue as #1718
@troykelly - the latest tag should fix this issue. Please let us know! https://github.com/pi-hole/docker-pi-hole/releases/tag/2025.02.2
@PromoFaux perfect, but perhaps documentation should/could be updated to not represent it as an array? It appears to just insert the text, so the below doesn't work:
[
"server=/61.10.in-addr.arpa./127.0.0.1#953",
"server=/example.invalid./127.0.0.1#953",
"server=/else.invalid./127.0.0.1#953",
"server=/domain.invalid./127.0.0.1#953"
]
services:
# Pihole
pihole:
image: pihole/pihole:latest
environment:
FTLCONF_misc_dnsmasq_lines: "[\"server=/61.10.in-addr.arpa./127.0.0.1#953\",\"server=/example.invalid./127.0.0.1#953\",\"server=/else.invalid./127.0.0.1#953\",\"server=/domain.invalid./127.0.0.1#953\"]"
cap_add:
- NET_ADMIN
network_mode: host
But, just adding the lines works perfectly. Thank you @DL6ER
services:
# Pihole
pihole:
image: pihole/pihole:latest
environment:
FTLCONF_misc_dnsmasq_lines: |
server=/61.10.in-addr.arpa./127.0.0.1#953
server=/example.invalid./127.0.0.1#953
server=/else.invalid./127.0.0.1#953
server=/domain.invalid./127.0.0.1#95
cap_add:
- NET_ADMIN
network_mode: host
#### Additional user configuration - START ####
server=/61.10.in-addr.arpa./127.0.0.1#953
server=/example.invalid./127.0.0.1#953
server=/else.invalid./127.0.0.1#953
server=/domain.invalid./127.0.0.1#95
#### Additional user configuration - END ####
Hey, i am not sure if this is exactly my issue, but i contributed to a separate docker image based on the official pihole:latest image and am now trying to update it to the latest changed. In the past the image used /etc/services.d/ to start other services separately from running the main pihole entrypoint without overwriting anything. This was a very good and working approach, but now i cannot use this anymore, because it seems like the alpine image does not contain any kind of init system.
I tried changing the entrypoint (which i really do not want to do, as i do not want to interferre with the entrypoint of the base pihole image) but that did not work either, i kept getting errors, that it couldnt start and stopped the container.
Therefore could you please add an init system OR add a mechanic do expand the startup of the image maybe through additional scripts in a specific directory.