Enabling DHCP Server Breaks Pi-Hole





Please follow the below template, it will help us to help you!

If you are Experiencing issues with a Pi-hole install that has non-standard elements (e.g you are using nginx instead of lighttpd, or there is some other aspect of your install that is customised) - please use the Community Help category.

Expected Behaviour:

I am not a Pi-Hole or Docker expert.
I have newly installed Pi-Hole running on a new Intel I7 based Nuc and Windows 11 Pro under Docker.
Home network is Netgear Orbi and gateway/router is 192.168.1.1
Pi-Hole and docker are installed on machine at 192.168.1.99
Pi-Hole appears to be running and blocking ads on one machine.
I want to use DHCP LAN-wide within P-Hole so I disable DHCP in Orbi and Enable in Pi-Hole.

Actual Behaviour:

Without DHCP server turned on, things appear to be normal (see Image 1 & 2)
When I enable Pi-Hole DHCP it breaks the dashboard and gives error message under settings "There was a problem applying your setting. Debug Info. PHP error (2): fsockopen(): unable to connect to 127.0.0.1:4711 (Connection refused) in /var/www/html/admin/scripts/pi-hole/php/FTL.php:47 On dashboard all categories have NaN at top and 'wait wheels' spin away.
See images 3, 4 & 5

Debug Token:

[✗] There was an error uploading your debug log.

  • Please try again or contact the Pi-hole team for assistance.
  • A local copy of the debug log can be found at: /var/log/pihole/pihole_debug.log

(I saved this as a PDF but it wont allow me to send to you)

Post your docker-compose.yml file please.

I did not use docker-compose to install this... just a command line in docker desktop. Is there a file I can send from there?
(Thanks!)

What command line did you use?

I'm looking for the environment variables set, the network mode used, all of the information that would be used for docker DHCP GitHub - pi-hole/docker-pi-hole: The official Pi-hole Docker image from pi-hole.net

Edit: That links to Docker DHCP and Network Modes - Pi-hole documentation

I did not use the command docker run --net=host -- I am thinking I should have.

The command line was

docker run -d --name pihole -e ServerIP=192.168.1.99 -e WEBPASSWORD=mypw -e TZ=America/Detroit -e DNS1=127.17.0.1 -e DNS2=1.1.1.1 -e DNS3=1.0.0.1 -p 80:80 -p 53:53/tcp -p 53:53/udp -p 443:443 --restart=unless-stopped pihole/pihole:latest

It is not totally clear how I use the "network_mode: host" command.

Thank you for your time & advice.

The way you implement DHCP broadcasts being heard by the docker container is up to you. The documentation I linked covers that pretty extensively.

Your docker run command is missing quite a few environment variables that need to be populated if you want to have the container even capable of being the DHCP server.

I highly suggest reading through our well documented README that covers just about anything and everything you'll need to know to run dockerized Pi-hole.

https://github.com/pi-hole/docker-pi-hole#readme

I don't understand what you are asking here.

Thanks for this.

In reading, there was an article that said to bridge outside of the container, you needed to have the
command "network_mode: Host" in the container startup command line to allow it to access resources outside of the container. It said this command would take the place of the -p arguments in the startup command line. Not sure if that article was BS or not.

(I said I was a beginner on Docker & Pi_Hole so dont laugh!)

Thank you so much for your time and patience.

Hopefully our documentation cleared that confusion up for you.

And yes, if you run the container in host networking mode you will no longer need to specify ports on the command line.

If you are using Pi-hole as DHCP server, you need to add --cap-add=NET_ADMIN to your docker command:

    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.