Docker Swarm and Client Count Issues

Hi, I have been using Pihole on Docker with great success for about 6 months and decided to graduate to swarms. Pihole is my first attempt.

I have successfully created a service/swarm and the two containers are working as expected in relation to providing DNS to the network, fail over etc.

One difference now on the Pihole GUI is the “clients” are only showing as “2” (localhost and any other device does not even show up as an IP address. I have at least 34 devices on my network when viewed with the standard Docker setup so this is purely a swarm issue that I have probably created.
I suspect that the swarm is NATing the real network addresses in some way so they only appear from that one IP.
Can anyone provide a clue as to why this might be the case and how to resolve it?

Here is my run command:
docker service create --name pihole
–dns= --dns=
-p 53:53/udp
-p 443:443/tcp
-p 53:53/tcp
-p 32774:80/tcp
–mount type=volume,src=pihole,dst=/etc/pihole
–mount type=volume,src=dnsmasq.d,dst=/etc/dnsmasq.d
–replicas 2
–env TZ=Australia/Melbourne
–env ServerIP=
–env DNS1=
–env DNS2=
–env WEBPASSWORD=pihole
–env IPv6=False
–mode replicated


When your LAN IPs don’t show up correctly in docker bridge mode you can have better luck getting that working with Bridge or MACVLan modes as described on this page:

If these modes don’t work for Swarm then I’m not sure exactly what can be done.

diginc’s solution works for singular pihole containers, swarm mode throws a serious wrench into the works.

The solution for swarms of piholes is fairly involved if you aren’t familiar with setting up a transparent reverse proxy, requiring:

  • configuring a reverse proxy server with ports bound in host mode
  • modifying the pi-hole container; specifically, baking in NAT rules.

If you’re on docker for windows, there is no solution.


This runs afoul of moby/moby/25526.

The short of it is this, if you want to use swarm mode you’re best bet is setting up a reverse proxy (with ports bound in host mode) and set up the reverse proxy and pihole containers for Direct Server Return. Nginx has a decent tutorial about this here.

I’d suggest following the guide with docker-compose up/down (such that you can use the build directive to bake in the required packages and entrypoint commands) and once you have that working migrate the changes to the pihole image for use with swarm.