Please follow the below template, it will help us to help you!
Expected Behaviour:
Pinging server by its hostname from the client works.
Pinging Pi-Hole by its hostname from the client and the server works.
Actual Behaviour:
Getting "unknown host" for both.
Debug Token:
97t9m2z2ye
I am running the pihole within a Docker container on my home router, which serves both DNS and DHCP. The router's host IP is 10.0.0.1.
This is how I created the container:
docker run -d --hostname pihole --name pihole -p 53:53/tcp -p 53:53/udp -p 10.0.0.1:67:67/udp -p 10.0.0.1:80:80 -p 10.0.0.1:443:443 -v /etc/pihole/:/etc/pihole/ -v /etc/dnsmasq.d/:/etc/dnsmasq.d/ -v /etc/dnsmasq.d-available/:/etc/dnsmasq.d-available/ -e ServerIP=10.0.0.1 --restart=unless-stopped --cap-add=NET_ADMIN --dns=127.0.0.1 --dns=1.1.1.1 pihole/pihole:latest
The ServerIP points to host IP, which according to various sources on the internet, is the right thing to do for the local LAN Pi-Hole setup.
However, it looks like Pi-Hole assumes the 10.0.0.1 is also its own IP address somehow. The /etc/hosts inside the container correctly maps pihole to 10.0.0.2 IP address:
root@pihole:/# cat /etc/hosts
127.0.0.1 localhost
10.0.0.2 pihole
However, the /etc/pihole/local.list
is:
10.0.0.1 pihole
10.0.0.1 pi.hole
, which seems wrong to me.
nslookup results are even more confusing:
nslookup pi.hole
Server: 10.0.0.2
Address: 10.0.0.2#53
Name: pi.hole
Address: 10.0.0.1
, and:
nslookup pihole
Server: 10.0.0.2
Address: 10.0.0.2#53
Name: pihole
Address: 10.0.0.1
Name: pihole
Address: 10.0.0.2
As a result:
- I can't ping my router from my clients or from within the container by its hostname
- I can ping the Pi-Hole from my router by the pihole hostname, but not from my clients
- I can ping the Pi-Hole from my router and clients using the pi.hole hostname
PS. You may want to add to the Docker wiki instructions that mapping the /etc/dnsmasq.d-available/ may also be needed, given that it's not uncommon to have other packages (e.g. LXD) symlink the configs saved there to /etc/dnsmasq.d/