I believe that I'm using pi-hole for a common reason: prevent annoying ads, protect my privacy, keep malware outside.
Now I want all devices in my to use pihole, which runs as a container on my TrueNAS box. I have configured it to use my unbound resolver (on the Opnsense firewall) as upstream DNS.
Now I noticed that the pihole image has 8.8.8.8 (google dns) in its /etc/resolv.conf.
I am not sure when this dns server will be used, but I can imagine this is for updating the block lists, and check for pihole updates.
I wonder: is using the google DNS the best option we have? (especially to guard ones privacy)
Starting a container without configuring docker --dns option should result in this /etc/resolv.conf:
# Generated by Docker Engine.
# This file can be edited; Docker Engine will not make further changes once it
# has been modified.
nameserver 127.0.0.11
options ndots:0
If your container is showing 8.8.8.8 some configuration is setting this value.
Can you please post your full compose file or docker run command used to start the container?
I have checked again and /etc/resolv.conf still has 8.8.8.8.
In the GUI the pihole container is configured with a static network interface without a dns setting.
At the moment TrueNAS itself is using 8.8.8.8 as its dns server too; is that where it comes from?
To test I have changed that to 9.9.9.9 and restarted the pihole container.
And yes: pi-hole now has 9.9.9.9.
But how does it get that? (I'll change the truenas DNS server to the pihole, but for that I first need to create a bridge interface so it can connect; still working on that)
By default, Docker containers would use DNS servers as defined in the host system's /etc/resolv.conf, either directly by copying the file into a container or indirectly via Docker's internal DNS resolver using the nameservers from /etc/resolv.conf as upstreams, depending on a container's network mode.