Pi-hole Docker does not show Wireguard Peers as Clients

I am pretty new using docker and I am migrating my pivpn-pihole services to docker and everything is working as expected
But Pi-hole does not show the Wireguard Peers as clients, I have tried creating the DNS entry in the pihole/custom.list, but it always shows three clients:

  • wireguard.mynet
  • localhost
  • 10.172.168.1

Is it possible to achieve this?

Thanks in advance for your help

docker-compose.yml

version: "3"

networks:
  net:
    name: mynet
    driver: bridge
    ipam:
        driver: default
        config:
           - subnet: 10.172.168.0/24
             gateway: 10.172.168.1

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    restart: unless-stopped
    hostname: pihole
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 8880:80/tcp
   dns:
      - 1.1.1.1
      - 1.0.0.1
    environment:
      TZ: "America/New_York"
      WEBPASSWORD: "password" # Blank password - Can be whatever you want.
      ServerIP: 10.172.168.10 # Internal IP of pihole
      DNS1: 1.1.1.1
      DNS2: 1.0.0.1
      PIHOLE_DOMAIN: myvpn
      WEBTHEME: "default-dark"
    volumes:
      - ./pihole/:/etc/pihole/
      - ./dnsmasq.d/:/etc/dnsmasq.d/
    networks:
      net:
        ipv4_address: 10.172.168.10

  wireguard:
    depends_on: [pihole]
    container_name: wireguard
    image: lscr.io/linuxserver/wireguard:latest
    restart: unless-stopped
    hostname: wireguard
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    environment:
      - PUID=1001
      - PGID=1001
      - TZ=America/New_York 
      - SERVERPORT=51820
      - SERVERURL=my.domain.com 
      - PEERS=peer1, peer2 
      - PEERDNS=10.172.168.10 # Pihole
      - INTERNAL_SUBNET=172.16.10.0
      - ALLOWEDIPS=0.0.0.0/0 
    volumes:
      - ./wireguard/:/config
      - /lib/modules:/lib/modules
    ports:
      - 51820:51820/udp
    dns:
      - 10.172.168.10 #pihole
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
    networks:
      net:
        ipv4_address: 10.172.168.15

custom.list

172.16.10.1 server.wg
172.16.10.2 peer1.wg
172.16.10.3 peer2.wg

This doesn't look like a Pi-hole issue:
Pi-hole is part of your Docker internal network 10.172.168.0/24.
While your wireguard container is using Pi-hole's Docker internal address for DNS, I'd guess it would be NATing requests from its encrypted wireguard internal network 172.16.10.0 to your Pi-hole on Docker's unencrypted internal network, so Pi-hole would see all DNS requests as originating from your wireguard container.

You should consider to consult your wireguard container's maintainer for assistance on how to address this.

Hej,

Any updates on this? I‘m highly interested in it.

Thanks a lot :slight_smile: