Public Repository

Last pushed: 15 hours ago
Short Description
Automated PDNSd Permanent Caching Nameserver/AdBlock built from alpine-s6 on a Raspberry Pi 3.
Full Description

Alpine-pDNSd

Container for pDNSd - Self-hosted Caching DNS.


This image contains the pDNSd caching nameserver with
permanent caching to disk. Used for

  • locally cache DNS records,
  • serve local hostnames from /data/hosts/hosts.local,
  • blocking ADs or malicious sites via hosts lists.

Built from my alpine-s6 image using the last released pDNSd.

Based on Alpine Linux.

The image is tagged respectively for the following architectures,

  • armhf

AdBlock Hosts


If the following files don't exits, the container downloads the hosts lists from

into /data/hosts/. These are enabled in the default
configuration, and can be a little too restrictive for some.
Update the host files themselves or drop your own configuration at
/data/pdnsd.conf to get around it.

Another hacky way is to sed through the hosts replacing the site
you want to unblock. e.g let's say we want to unblock RT News,
(assuming it gets blocked on some versions from hpHosts). So after
getting a shell into the container, run,

sed -i \
  -e 's/\([ .]\)rt.com/\1notrt.com/g' \
  /data/hosts/*

Get the Image


Pull the image for your architecture it's already available from
Docker Hub.

# make pull
docker pull arpanpal010/alpine-pdnsd:armhf

Run


On many systemd derivations e.g. ArchLinux, 53/udp may be already taken by systemd-resolved. In
that case, it will need to be stopped first before dns server is
started. Run,

sudo systemctl stop systed-resolved

# make
docker run --rm -it \
  --name docker_pdnsd --hostname pdnsd \
  -e PGID=100 -e PUID=1001 \
  -c 256 -m 256m \
  -p 53/tcp -p 53/udp \
  -v $(CURDIR)/data:/data \
  -v /etc/hosts:/etc/hosts:ro \
  -v /etc/localtime:/etc/localtime:ro \
  -e TZ=Asia/Kolkata \
  arpanpal010/alpine-pdnsd:armhf

# make stop
docker stop -t 2 docker_pdnsd

# make rm
# stop first
docker rm -f docker_pdnsd

# make restart
docker restart docker_pdnsd

Shell access


# make rshell
docker exec -u root -it docker_pdnsd /bin/bash

# make shell
docker exec -it docker_pdnsd /bin/bash

# make logs
docker logs -f docker_pdnsd

Services


PS: this bit is for dev only as you need the files from the repo.

# make systemd
# add systemd.service as a service if it exists, load it, and start or restart
# it if already running.

# make updatehosts
# update hosts file lists from the sources

Development


If you have the repository access, you can clone and
build the image yourself for your own system, and can push after.


Setup


Before you clone the repo, you must have Git, GNU make,
and Docker setup on the machine.

git clone <repository url>
cd <repository>

You can always skip installing make but you will have to
type the whole docker commands then instead of using the sweet
make targets.


Build


To locally build the image for your system.

# make build
docker build --rm --force-rm \
  -t arpanpal010/alpine-pdnsd:armhf \
  --no-cache=true --pull .

# make push
docker push arpanpal010/alpine-pdnsd:armhf

Maintenance


Currently built daily on a RaspberryPi3 (armhf builds) or IntelNUC
(x64 builds). Docker hub builds maintained by arpanpal010.

Docker Pull Command
Owner
arpanpal010

Comments (0)