Skip to main content

Pihole Setup

mkdir /mnt/glustermount/data/pihole_traefik
mkdir /mnt/glustermount/data/pihole_traefik/dns
mkdir /mnt/glustermount/data/pihole_traefik/etc


version: '3'

services:
  pihole:
    networks:
      - management_net  # For management via Traefik or Portainer
      - security_net    # For secure handling of DNS queries
      - app_net         # If it needs to interact with other services on this network
    image: pihole/pihole:latest
    # For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "890:80/tcp"
    environment:
      TZ: 'Europe/Zurich'
      WEBPASSWORD: '${PIHOLE_PASSWORD}'
    # Volumes store your data between container upgrades
    volumes:
      - '/mnt/glustermount/data/pihole_data/etc:/etc/pihole'
      - '/mnt/glustermount/data/pihole_data/dns:/etc/dnsmasq.d'
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
    restart: unless-stopped
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.platform.os == linux]
networks:
  management_net:
    external: true
  security_net:
    external: true
  app_net:
    external: true