Cloud
Docker Compose
Installing PowerDNS

Installing PowerDNS

PowerDNS is an easy to use DNS Server with support for both recursive and authoritative queries.

Checking Port 53 Availability

Usually systemd uses port 53 for local dns queries. You can check what services are using port 53 with the following command:

lsof -i :53

You may need to disable this service but proceed with caution since this will break DNS queries if you don't handle DNS elsewhere.

systemctl disable systemd-resolved

Make sure DNS requests still work after disabling systemd:

ping example.com

If you get a resolution error, make sure you set DNS resolvers in /etc/resolv.conf or your network config.

Authoritative PowerDNS Configuration

Replace PASSWORD_HERE with a password and 192.168.53.72 with your public IP address

docker-compose.yml
version: '3'
 
services:
  db:
    image: mariadb:latest
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - MYSQL_DATABASE=powerdnsadmin
      - MYSQL_USER=pdns
      - MYSQL_PASSWORD=PASSWORD_HERE
    ports:
      - 127.0.0.1:3306:3306
    restart: always
    volumes:
      - /pda-mysql:/var/lib/mysql
  pdns:
    image: pschiffe/pdns-mysql
    hostname: pdns
    domainname: dns.example.com
    restart: always
    depends_on:
      - db
    links:
      - "db:mysql"
    ports:
      - "192.168.53.72:53:53"
      - "192.168.53.72:53:53/udp"
      - "8081:8081"
    environment:
      - PDNS_gmysql_host=db
      - PDNS_gmysql_port=3306
      - PDNS_gmysql_user=pdns
      - PDNS_gmysql_dbname=powerdnsadmin
      - PDNS_gmysql_password=PASSWORD_HERE
      - PDNS_master=yes 
      - PDNS_api=yes
      - PDNS_api_key=PASSWORD_HERE 
      - PDNSCONF_API_KEY=PASSWORD_HERE 
      - PDNS_webserver=yes 
      - PDNS_webserver-allow-from=127.0.0.1,10.0.0.0/8,172.0.0.0/8,192.0.0.0/24 
      - PDNS_webserver_address=0.0.0.0 
      - PDNS_webserver_password=PASSWORD_HERE 
      - PDNS_version_string=anonymous 
      - PDNS_default_ttl=1500 
      - PDNS_allow_notify_from=0.0.0.0 
      - PDNS_allow_axfr_ips=127.0.0.1
      - PDNS_default_soa_content=ns1.example.net hostmaster.@ 0 10800 3600 604800 3600
 
  web_app:
    image: powerdnsadmin/pda-legacy:dev
    container_name: powerdns_admin
    ports:
      - 127.0.0.1:8080:80
    depends_on:
      - db
    restart: always
    links:
      - db:mysql
      - pdns:pdns
    logging:
      driver: json-file
      options:
        max-size: 50m
    environment:
      - SQLALCHEMY_DATABASE_URI=mysql://pdns:PASSWORD_HERE@db/powerdnsadmin
      - GUNICORN_TIMEOUT=60
      - GUNICORN_WORKERS=2
      - GUNICORN_LOGLEVEL=DEBUG
docker compose up -d