services:
  adguard:
    image: adguard/adguardhome:latest
    container_name: adguard
    #network_mode: "host"  # DHCP server - optional, only if AdGuard handles DHCP
    restart: always
    deploy:
      resources:
        limits:
          memory: 256M
        reservations:
          memory: 64M
    healthcheck:
      test:
        - CMD-SHELL
        - /opt/adguardhome/AdGuardHome --check-config -w /opt/adguardhome/work
          -c /opt/adguardhome/conf/AdGuardHome.yaml
      interval: 45s
      timeout: 30s
      retries: 3
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Moscow
    volumes:
      - /opt/data/adguard/work:/opt/adguardhome/work:rw
      - /opt/configs/adguard:/opt/adguardhome/conf:rw
      - /etc/hosts:/etc/hosts:ro
    ports:
      - 53:53/tcp # DNS - **mandatory**
      - 53:53/udp # DNS - **mandatory**
      #- "67:67/udp"      # DHCP server - optional, only if AdGuard handles DHCP
      #- "68:68/udp"      # DHCP server - optional
      - 8088:80/tcp # Dashboard HTTP - optional, only if not using HTTPS
      - 4438:443/tcp # DNS-over-HTTPS / dashboard HTTPS - optional but recommended if using DoH
      - 784:784/udp # DNS-over-QUIC (beta) - optional, experimental
      - 853:853/tcp # DNS-over-TLS - optional
      - 3015:3000/tcp # Dashboard initial config - optional, only for initial setup
      - 5443:5443/tcp # DNSCrypt / alternative DoH - optional
      - 5443:5443/udp # DNSCrypt depends on TCP - optional
      #- "6060:6060/tcp"  # Internal API - optional, do not expose
      #- "8853:8853/udp"  # DNS mTLS (beta) - optional, experimental
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
networks: {}
