{"id":13558671,"url":"https://github.com/pschiffe/docker-pdns","last_synced_at":"2025-04-08T12:11:08.280Z","repository":{"id":17756921,"uuid":"67253721","full_name":"pschiffe/docker-pdns","owner":"pschiffe","description":"Docker images for PowerDNS","archived":false,"fork":false,"pushed_at":"2025-03-20T11:30:02.000Z","size":229,"stargazers_count":299,"open_issues_count":6,"forks_count":92,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-03T15:05:08.627Z","etag":null,"topics":["ansible","dns","dns-server","docker","docker-compose","docker-image","mysql","pdns","pdns-admin","pdns-authoritative","pdns-mysql","pdns-pgsql","pdns-recursor","postgres","powerdns","powerdns-admin","powerdns-authoritative","powerdns-recursor","powerdns4"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pschiffe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"pschiffe","custom":"https://www.paypal.com/paypalme/pschiffe"}},"created_at":"2016-09-02T20:45:12.000Z","updated_at":"2025-03-22T09:01:26.000Z","dependencies_parsed_at":"2023-01-16T20:16:33.621Z","dependency_job_id":"4b2ce325-7045-489f-a3e2-7287503f5a47","html_url":"https://github.com/pschiffe/docker-pdns","commit_stats":{"total_commits":148,"total_committers":15,"mean_commits":9.866666666666667,"dds":0.3648648648648649,"last_synced_commit":"643f44b9f9aa12f91031cac1ade314c8dfd2b7d5"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschiffe%2Fdocker-pdns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschiffe%2Fdocker-pdns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschiffe%2Fdocker-pdns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschiffe%2Fdocker-pdns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pschiffe","download_url":"https://codeload.github.com/pschiffe/docker-pdns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838445,"owners_count":21004580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","dns","dns-server","docker","docker-compose","docker-image","mysql","pdns","pdns-admin","pdns-authoritative","pdns-mysql","pdns-pgsql","pdns-recursor","postgres","powerdns","powerdns-admin","powerdns-authoritative","powerdns-recursor","powerdns4"],"created_at":"2024-08-01T12:05:05.535Z","updated_at":"2025-04-08T12:11:08.259Z","avatar_url":"https://github.com/pschiffe.png","language":"Shell","funding_links":["https://github.com/sponsors/pschiffe","https://www.paypal.com/paypalme/pschiffe","https://img.shields.io/badge/paypal.me-grey?logo=paypal"],"categories":["Shell","ansible"],"sub_categories":[],"readme":"# PowerDNS Docker Images\n\nThis repository contains the following Docker images - pdns-mysql, pdns-pgsql, pdns-recursor and pdns-admin. Image **pdns-mysql** contains completely configurable [PowerDNS 4.x server](https://doc.powerdns.com/authoritative/) with mysql backend (without mysql server). Image **pdns-pgsql** contains completely configurable [PowerDNS 4.x server](https://doc.powerdns.com/authoritative/) with postgres backend (without postgres server). Image **pdns-recursor** contains completely configurable [PowerDNS 5.x recursor](https://doc.powerdns.com/recursor/). Image **pdns-admin** contains fronted (Caddy) and backend (uWSGI) for the [PowerDNS Admin](https://github.com/PowerDNS-Admin/PowerDNS-Admin) web app, which is written in Flask and used for managing PowerDNS servers.\n\nThe pdns-mysql, pdns-pgsql and pdns-recursor images have also the `alpine` tag, thanks to @PoppyPop.\n\nAll images are available on Docker Hub:\n\nhttps://hub.docker.com/r/pschiffe/pdns-mysql/\n\nhttps://hub.docker.com/r/pschiffe/pdns-pgsql/\n\nhttps://hub.docker.com/r/pschiffe/pdns-recursor/\n\nhttps://hub.docker.com/r/pschiffe/pdns-admin/\n\nSource GitHub repository: https://github.com/pschiffe/docker-pdns\n\n---\n[![Static Badge](https://img.shields.io/badge/GitHub_Sponsors-grey?logo=github)](https://github.com/sponsors/pschiffe) [![Static Badge](https://img.shields.io/badge/paypal.me-grey?logo=paypal)](https://www.paypal.com/paypalme/pschiffe)\n\nIf this project is useful to you, please consider sponsoring me to support maintenance and further development. Thank you!\n\n## pdns-mysql\n\n![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pschiffe/pdns-mysql/latest?label=latest) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pschiffe/pdns-mysql/alpine?label=alpine) ![Docker Pulls](https://img.shields.io/docker/pulls/pschiffe/pdns-mysql)\n\nhttps://hub.docker.com/r/pschiffe/pdns-mysql/\n\nDocker image with [PowerDNS 4.x server](https://doc.powerdns.com/authoritative/) and mysql backend. Requires external mysql server. Env vars for mysql configuration:\n```\n(name=default value)\n\nPDNS_gmysql_host=mysql\nPDNS_gmysql_port=3306\nPDNS_gmysql_user=root\nPDNS_gmysql_password=powerdns\nPDNS_gmysql_dbname=powerdns\n```\n\nIf linked with the official [mariadb](https://hub.docker.com/_/mariadb/) image using the alias `mysql`, the connection can be automatically configured, eliminating the need to specify any of the above. The DB is automatically initialized if tables are missing.\n\nThe PowerDNS server is configurable via env vars. Every variable starting with `PDNS_` will be inserted into `/etc/pdns/pdns.conf` conf file in the following way: prefix `PDNS_` will be stripped away and every `_` will be replaced with `-`. For example, from the above mysql config, `PDNS_gmysql_host=mysql` will became `gmysql-host=mysql` in `/etc/pdns/pdns.conf` file. This way, you can configure PowerDNS server in any way you need within a `docker run` command.\n\nThe `SUPERMASTER_IPS` env var is also supported, which can be used to configure supermasters for a slave DNS server. [Docs](https://doc.powerdns.com/authoritative/modes-of-operation.html#autoprimary-automatic-provisioning-of-secondaries). Multiple IP addresses separated by spaces should work.\n\nYou can find all the available settings [here](https://doc.powerdns.com/authoritative/settings.html).\n\n### Examples\n\nExample of a master server with the API enabled and one slave server configured:\n```\ndocker run -d -p 53:53 -p 53:53/udp --name pdns-master \\\n  --hostname ns1.example.com --link mariadb:mysql \\\n  -e PDNS_primary=yes \\\n  -e PDNS_api=yes \\\n  -e PDNS_api_key=secret \\\n  -e PDNS_webserver=yes \\\n  -e PDNS_webserver_address=0.0.0.0 \\\n  -e PDNS_webserver_password=secret2 \\\n  -e PDNS_version_string=anonymous \\\n  -e PDNS_default_ttl=1500 \\\n  -e PDNS_allow_axfr_ips=172.5.0.21 \\\n  -e PDNS_only_notify=172.5.0.21 \\\n  pschiffe/pdns-mysql\n```\n\nExample of a slave server with a supermaster:\n```\ndocker run -d -p 53:53 -p 53:53/udp --name pdns-slave \\\n  --hostname ns2.example.com --link mariadb:mysql \\\n  -e PDNS_gmysql_dbname=powerdnsslave \\\n  -e PDNS_secondary=yes \\\n  -e PDNS_autosecondary=yes \\\n  -e PDNS_version_string=anonymous \\\n  -e PDNS_disable_axfr=yes \\\n  -e PDNS_allow_notify_from=172.5.0.20 \\\n  -e SUPERMASTER_IPS=172.5.0.20 \\\n  pschiffe/pdns-mysql\n```\n\n## pdns-pgsql\n\n![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pschiffe/pdns-pgsql/latest?label=latest) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pschiffe/pdns-pgsql/alpine?label=alpine) ![Docker Pulls](https://img.shields.io/docker/pulls/pschiffe/pdns-pgsql)\n\nhttps://hub.docker.com/r/pschiffe/pdns-pgsql/\n\nDocker image with [PowerDNS 4.x server](https://doc.powerdns.com/authoritative/) and postgres backend. Requires external postgres server. Env vars for pgsql configuration:\n```\n(name=default value)\n\nPDNS_gpgsql_host=pgsql\nPDNS_gpgsql_port=5432\nPDNS_gpgsql_user=postgres\nPDNS_gpgsql_password=powerdns\nPDNS_gpgsql_dbname=powerdns\n```\n\nIf linked with the official [postgres](https://hub.docker.com/_/postgres) image using the alias `pgsql`, the connection can be automatically configured, eliminating the need to specify any of the above. The DB is automatically initialized if tables are missing.\n\nThe PowerDNS server is configurable via env vars. Every variable starting with `PDNS_` will be inserted into `/etc/pdns/pdns.conf` conf file in the following way: prefix `PDNS_` will be stripped away and every `_` will be replaced with `-`. For example, from the above pgsql config, `PDNS_gpgsql_host=pgsql` will became `gpgsql-host=pgsql` in `/etc/pdns/pdns.conf` file. This way, you can configure PowerDNS server in any way you need within a `docker run` command.\n\nThe `SUPERMASTER_IPS` env var is also supported, which can be used to configure supermasters for a slave DNS server. [Docs](https://doc.powerdns.com/authoritative/modes-of-operation.html#autoprimary-automatic-provisioning-of-secondaries). Multiple IP addresses separated by spaces should work.\n\nYou can find all the available settings [here](https://doc.powerdns.com/authoritative/settings.html).\n\n### Examples\n\nExample of a master server with the API enabled and one slave server configured:\n```\ndocker run -d -p 53:53 -p 53:53/udp --name pdns-master \\\n  --hostname ns1.example.com --link postgres:pgsql \\\n  -e PDNS_primary=yes \\\n  -e PDNS_api=yes \\\n  -e PDNS_api_key=secret \\\n  -e PDNS_webserver=yes \\\n  -e PDNS_webserver_address=0.0.0.0 \\\n  -e PDNS_webserver_password=secret2 \\\n  -e PDNS_version_string=anonymous \\\n  -e PDNS_default_ttl=1500 \\\n  -e PDNS_allow_axfr_ips=172.5.0.21 \\\n  -e PDNS_only_notify=172.5.0.21 \\\n  pschiffe/pdns-pgsql\n```\n\nExample of a slave server with a supermaster:\n```\ndocker run -d -p 53:53 -p 53:53/udp --name pdns-slave \\\n  --hostname ns2.example.com --link postgres:pgsql \\\n  -e PDNS_gpgsql_dbname=powerdnsslave \\\n  -e PDNS_secondary=yes \\\n  -e PDNS_autosecondary=yes \\\n  -e PDNS_version_string=anonymous \\\n  -e PDNS_disable_axfr=yes \\\n  -e PDNS_allow_notify_from=172.5.0.20 \\\n  -e SUPERMASTER_IPS=172.5.0.20 \\\n  pschiffe/pdns-pgsql\n```\n\n## pdns-recursor\n\n![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pschiffe/pdns-recursor/latest?label=latest) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pschiffe/pdns-recursor/alpine?label=alpine) ![Docker Pulls](https://img.shields.io/docker/pulls/pschiffe/pdns-recursor)\n\nhttps://hub.docker.com/r/pschiffe/pdns-recursor/\n\nDocker image with [PowerDNS 5.x recursor](https://doc.powerdns.com/recursor/).\n\nPowerDNS recursor is configurable via env vars. Every variable starting with `PDNS_` will be inserted into `/etc/pdns/recursor.conf` conf file in the following way: prefix `PDNS_` will be stripped away and every `_` will be replaced with `-`. For example, from the above mysql config, `PDNS_gmysql_host=mysql` will became `gmysql-host=mysql` in `/etc/pdns/recursor.conf` file. This way, you can configure PowerDNS recursor any way you need within a `docker run` command.\n\nYou can find all available settings [here](https://doc.powerdns.com/recursor/settings.html).\n\n### Example\n\nRecursor server with API enabled:\n```\ndocker run -d -p 53:53 -p 53:53/udp --name pdns-recursor \\\n  -e PDNS_api_key=secret \\\n  -e PDNS_webserver=yes \\\n  -e PDNS_webserver_address=0.0.0.0 \\\n  -e PDNS_webserver_password=secret2 \\\n  pschiffe/pdns-recursor\n```\n\n## pdns-admin\n\n![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pschiffe/pdns-admin/latest?label=latest) ![Docker Pulls](https://img.shields.io/docker/pulls/pschiffe/pdns-admin)\n\nhttps://hub.docker.com/r/pschiffe/pdns-admin/\n\nDocker image with [PowerDNS Admin](https://github.com/PowerDNS-Admin/PowerDNS-Admin) web app, written in Flask, for managing PowerDNS servers. It needs external mysql or postgres server.\n\nThere is also an official image for the pdns-admin on [Docker Hub](https://hub.docker.com/r/powerdnsadmin/pda-legacy). That image contains only gunicorn process that handles both - static files and the python app. Image in this repo contains uWSGI server handling requests for python app and Caddy web server handling static files and optionally HTTPS with Let's Encrypt.\n\nEnv vars for mysql configuration:\n```\n(name=default value)\n\nPDNS_ADMIN_SQLA_DB_HOST=mysql\nPDNS_ADMIN_SQLA_DB_PORT=3306\nPDNS_ADMIN_SQLA_DB_USER=root\nPDNS_ADMIN_SQLA_DB_PASSWORD=powerdnsadmin\nPDNS_ADMIN_SQLA_DB_NAME=powerdnsadmin\n```\nIf linked with official [mariadb](https://hub.docker.com/_/mariadb/) image with alias `mysql`, the connection can be automatically configured, so you don't need to specify any of the above.\n\nEnv vars for pgsql configuration:\n```\nPDNS_ADMIN_SQLA_DB_TYPE=postgres\nPDNS_ADMIN_SQLA_DB_HOST=pgsql\nPDNS_ADMIN_SQLA_DB_PORT=5432\nPDNS_ADMIN_SQLA_DB_USER=postgres\nPDNS_ADMIN_SQLA_DB_PASSWORD=powerdnsadmin\nPDNS_ADMIN_SQLA_DB_NAME=powerdnsadmin\n```\n\nThe DB is automatically initialized if tables are missing.\n\nSimilar to the pdns-mysql, pdns-admin is also completely configurable via env vars. Prefix in this case is `PDNS_ADMIN_`, configuration will be written to the `/opt/powerdns-admin/powerdnsadmin/default_config.py` file.\n\n### Connecting to the PowerDNS server\n\nFor the pdns-admin to make sense, it needs a PowerDNS server to manage. The PowerDNS server needs to have exposed API (example configuration for PowerDNS 4.x):\n```\napi=yes\napi-key=secret\nwebserver=yes\nwebserver-address=0.0.0.0\nwebserver-allow-from=172.5.0.0/16\n```\n\nAnd again, PowerDNS connection is configured via env vars (it needs url of the PowerDNS server, api key and a version of PowerDNS server, for example 4.0):\n```\n(name=default value)\n\nPDNS_API_URL=\"http://pdns:8081/\"\nPDNS_API_KEY=\"\"\nPDNS_VERSION=\"\"\n```\n\nIf this container is linked with pdns-mysql from this repo with alias `pdns`, it will be configured automatically and none of the env vars from above are needed to be specified.\n\n### PowerDNS Admin API keys and SALT\n\nIn order to be able to generate an API Key, you will need to specify the SALT via `PDNS_ADMIN_SALT` env var. This is a secret value, which can be generated via command:\n```\npython3 -c 'import bcrypt; print(bcrypt.gensalt().decode(\"utf-8\"));'\n```\nExample value looks like `$2b$12$xxxxxxxxxxxxxxxxxxxxxx` - remember that when using docker-compose, literal `$` must be specified as `$$`.\n\n### SSL with Let's Encrypt\n\nIncluded Caddy server can optionally handle HTTPS with certificates from Let's Encrypt. To make this work, add `SSL_MAIN_DOMAIN` env var with your primary domain for HTTPS. The `SSL_EXTRA_DOMAINS` env var can contain list of comma-separated domains that will be redirected to the `SSL_MAIN_DOMAIN`. Public DNS must be properly configured and pdns-admin ports `8080`, `8443` and `8443/udp` must be exposed as `80`, `443` and `443/udp` (`443/udp` is for HTTP/3 traffic).\n\nFinally, make the `/var/lib/caddy` dir inside of the pdns-admin container persistent - that's where the generated certificates will be stored.\n\n### Persistent data\n\nThere is also a directory with user uploads which should be persistent: `/opt/powerdns-admin/upload`\n\n### Examples\n\nWhen linked with pdns-mysql from this repo:\n```\ndocker run -d -p 8080:8080 --name pdns-admin \\\n  --link mariadb:mysql --link pdns-master:pdns \\\n  -v pdns-admin-upload:/opt/powerdns-admin/upload \\\n  pschiffe/pdns-admin\n```\n\nThe same with HTTPS:\n```\ndocker run -d -p 80:8080 -p 443:8443 -p 443:8443/udp --name pdns-admin \\\n  --link mariadb:mysql --link pdns-master:pdns \\\n  -v pdns-admin-caddy:/var/lib/caddy \\\n  -v pdns-admin-upload:/opt/powerdns-admin/upload \\\n  -e SSL_MAIN_DOMAIN=www.pdns-admin.com \\\n  -e SSL_EXTRA_DOMAINS=pdns-admin.com,pdns-admin.eu \\\n  pschiffe/pdns-admin\n```\n\n## Docker Compose\n\nIncluded docker compose files contain example configuration of how to use these containers:\n```\ndocker-compose -f docker-compose-mysql.yml up -d\n```\n\n## Ansible playbook\n\nIncluded ansible playbooks can be used to build and run the containers from this repo. Run it with:\n```\nansible-playbook ansible-playbook-mysql.yml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschiffe%2Fdocker-pdns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpschiffe%2Fdocker-pdns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschiffe%2Fdocker-pdns/lists"}