Can't get DHCP server to work in dockered Pi-hole

I have been trying now for days and cannot seem to get it working

---
version: "3"

networks:
  dhcp-relay-net:
    ipam:
      config:
        - subnet: 172.31.0.0/16
  front-tier:
    external: true

volumes:
  pihole:

services:
  pihole:
    image: pihole/pihole:2022.10
    container_name: pihole
    hostname: pihole
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    ports:
      - "53:53/tcp"
      - "53:53/udp"
    expose:
      - 80
    env_file:
      - .env
    volumes:
      - pihole:/etc
      - ./dnsmasq.d/99-temp.conf:/etc/dnsmasq.d/99-temp.conf:ro
      - ./dnsmasq.d/07-dhcp-options.conf:/etc/dnsmasq.d/07-dhcp-options.conf:ro
      - ./pihole/custom.list:/etc/pihole/custom.list:ro
      - /etc/resolv.conf:/etc/resolv.conf:ro
    dns:
      - 127.0.0.1
      - 1.1.1.1
    depends_on:
      - dhcphelper
    networks:
      dhcp-relay-net:
          ipv4_address: '172.31.0.10'
      front-tier: {}

  dhcphelper:
    build: ./dhcp-helper
    restart: unless-stopped
    network_mode: "host"
    userns_mode: "host"
    command: -s 172.31.0.10
    cap_add:
      - NET_ADMIN

My .env file:

TZ=Europe/Berlin
VIRTUAL_HOST=pi.hole
DNSSEC=true
PIHOLE_DNS_=1.1.1.1
DHCP_ACTIVE=false
WEBPASSWORD=000000000
DNSMASQ_USER=root
PIHOLE_UID=0
FTLCONF_LOCAL_IPV4=192.168.1.62
DNSMASQ_LISTENING=all
DHCP_ACTIVE=true
DHCP_START=192.168.1.21
DHCP_END=192.168.1.254
DHCP_ROUTER=192.168.1.1
PIHOLE_DOMAIN=lan
ServerIP:192.168.1.62

Additional information:
my router: 192.168.1.1
Pihole: 192.168.1.62 (docker network 172.23.0.2)

What am i doing wrong :rage:
dhcp server is not working not getting any ip's

Your compose differs in various aspects from the original suggestions

Specifically (but not limited to), you seem to mount single files where DHCP with docker-compose and bridge networking (as well as Pi-hole's sample configuration for a standard Pi-hole) would do so with directories. This may well be relevant if you'd want lease information to persist.
In addition, you seem to be doing so for non-standard Pi-hole files, e.g. 07-dhcp-options.conf.

Other deviations would include, without being comprehensive (click for details):

I've found the following parts in your config to deviate just be diffing your compose against the original:

volumes:
  pihole:
    expose:
      - 80
    env_file:
      - .env
    networks:
      front-tier: {}

I'd strongly recommend to work with Pi-hole's defaults and the suggested configuration as closely as possible, and then gradually adopt it to your requirements.

Thanks this is from https://veerendra2.github.io/pihole-dhcp-relay/

I'll go back to basics to see if that helps

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