Pdns recursor (#6)

* Adding pdns recursor

* Adding pdns recursor with fedora

* pdns resolver version correction

* Update readme for pdns-recursor
This commit is contained in:
Steve HOLWEG 2017-12-11 14:18:10 +01:00 committed by Peter Schiffer
parent e10bf8f114
commit 1fddeda864
5 changed files with 86 additions and 1 deletions

View file

@ -1,6 +1,6 @@
# PowerDNS Docker Images
This repository contains four Docker images - pdns-mysql, pdns-admin-static, pdns-admin-uwsgi and deprecated pdns-admin. Image **pdns-mysql** contains completely configurable [PowerDNS 4.x server](https://www.powerdns.com/) with mysql backend (without mysql server). Images **pdns-admin-static** and **pdns-admin-uwsgi** contains fronted (nginx) and backend (uWSGI) for [PowerDNS Admin](https://git.0x97.io/0x97/powerdns-admin) web app, written in Flask, for managing PowerDNS servers. Pdns-admin is also completely configurable. Deprecated **pdns-admin** contains PowerDNS Admin in a single image where both nginx and uWSGI processes are managed by systemd. This image won't be updated anymore.
This repository contains five Docker images - pdns-mysql, pdns-admin-static, pdns-admin-uwsgi, pdns-recursor and deprecated pdns-admin. Image **pdns-mysql** contains completely configurable [PowerDNS 4.x server](https://www.powerdns.com/) with mysql backend (without mysql server). Image **pdns-recursor** contains completely configurable [PowerDNS 4.x recursor](https://www.powerdns.com/). Images **pdns-admin-static** and **pdns-admin-uwsgi** contains fronted (nginx) and backend (uWSGI) for [PowerDNS Admin](https://git.0x97.io/0x97/powerdns-admin) web app, written in Flask, for managing PowerDNS servers. Pdns-admin is also completely configurable. Deprecated **pdns-admin** contains PowerDNS Admin in a single image where both nginx and uWSGI processes are managed by systemd. This image won't be updated anymore.
All images are available on Docker Hub:
@ -146,6 +146,31 @@ docker run -d -p 8080:80 --name pdns-admin-static \
pschiffe/pdns-admin-static
```
## pdns-recursor
[![](https://images.microbadger.com/badges/image/pschiffe/pdns-recursor.svg)](http://microbadger.com/images/pschiffe/pdns-recursor "Get your own image badge on microbadger.com")
https://hub.docker.com/r/pschiffe/pdns-recursor/
Docker image with [PowerDNS 4.x recursor](https://www.powerdns.com/).
PowerDNS 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 and every `_` will be replaced with `-`. For example, from 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.
You can find [here](https://doc.powerdns.com/md/recursor/settings/) all available settings.
### Examples
Recursor server with API enabled:
```
docker run -d -p 53:53 -p 53:53/udp --name pdns-recursor \
-e PDNS_api=yes \
-e PDNS_api_key=secret \
-e PDNS_webserver=yes \
-e PDNS_webserver_address=0.0.0.0 \
-e PDNS_webserver_password=secret2 \
pschiffe/pdns-recursor
```
## pdns-admin - DEPRECATED
[![](https://images.microbadger.com/badges/image/pschiffe/pdns-admin.svg)](http://microbadger.com/images/pschiffe/pdns-admin "Get your own image badge on microbadger.com")

22
pdns-recursor/Dockerfile Normal file
View file

@ -0,0 +1,22 @@
FROM fedora:27
MAINTAINER "Peter Schiffer" <pschiffe@redhat.com>
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf \
&& dnf -y --setopt=install_weak_deps=False install \
pdns-recursor \
&& dnf clean all
RUN pip3 install envtpl \
&& rm -rf ~/.cache/*
ENV VERSION=4.0.6 \
PDNS_setuid=recursor \
PDNS_setgid=recursor \
PDNS_daemon=no
EXPOSE 53 53/udp
COPY recursor.conf.tpl /
COPY docker-cmd.sh /
CMD [ "/docker-cmd.sh" ]

View file

@ -0,0 +1,22 @@
FROM alpine:3.7
MAINTAINER "Peter Schiffer" <pschiffe@redhat.com>
RUN set -xe \
&& apk update --no-cache && apk upgrade --no-cache \
&& apk add --update --no-cache pdns-recursor python3 \
&& rm -rf /var/cache/apk/*
RUN pip3 install envtpl \
&& rm -rf ~/.cache/*
ENV VERSION=4.0.6 \
PDNS_setuid=recursor \
PDNS_setgid=recursor \
PDNS_daemon=no
EXPOSE 53 53/udp
COPY recursor.conf.tpl /
COPY docker-cmd.sh /
CMD [ "/docker-cmd.sh" ]

14
pdns-recursor/docker-cmd.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -euo pipefail
# Configure base vars
: "${PDNS_local_port:=53}"
: "${PDNS_local_address:=0.0.0.0}"
export PDNS_local_port PDNS_local_address
# Create config file from template
envtpl < /recursor.conf.tpl > /etc/pdns/recursor.conf
exec /usr/sbin/pdns_recursor

View file

@ -0,0 +1,2 @@
{% for key, value in environment('PDNS_') %}{{ key|replace('_', '-') }}={{ value }}
{% endfor %}