Closed mogaal closed 6 years ago
There are a couple ways to approach this, my top choice would just be save the DNSMasq settings you need out of the container using a docker volume. Make sure you start your container using the recommended volumes from the readme, I believe dnsmasq is one of those folders and could contain all the settings you appear to be modifying. Then instead of using a script run your commands through docker exec pihole
where pihole is the name of your pi-hole container from docker ps
(it's random if you didn't assign a hard coded name). So your commands would become this:docker exec dockerpihole pihole -a enabledhcp '192.168.1.10' '192.168.1.100' '192.168.1.1' '24' 'home.local' false
and then be saved to a docker volume for future re-use whenever the container is re-created.
Another way, which may be more in line with your existing script but wouldn't require building/baking it into the image would be just volume mount the script in to the default image. The first way to try would be mount it into /etc/cont-init.d/ folder, which will land right beside the 20-start.sh script, make it have a lower number to run before that and a higher number to run after. I'd say go for something like 30-custom.sh with your existing script and see if it works.
With environment variables we have some kind of limitation where it isn't possible to set up things like dhcp. Trying to find other ways to include custom set up/config at the container runtime I ended up changing
start.sh
script to include my own config commands. TheDockerfile
is as simplest as:Where it is added to the same
start.sh
we got in the repo the following three lines:And inside
my-config.sh
:Is it something I should consider a PR? Any better Idea? I also though about including a lot of DHCP env variables but it was easier and quicker this way. Any comments/ideas suggestions?
Alejandro