Dockerizing BIND v9

In case you’re on a Ubuntu Docker host, you will have to disable the default shit,

systemctl list-unit-files | grep bind
systemctl stop bind9.service
systemctl disable bind9.service

systemctl list-unit-files | grep resolv
systemctl stop systemd-resolved.service
systemctl disable systemd-resolved.service

Launch your CentOS7 custom container,

ls -alhF /data/$app/
docker ps -a | grep $app
docker run -d --name $app -h $app \
    -p 53:53/udp -p 53:53 \
    -v /data/$app:/$app \
docker ps -a | grep $app
docker logs $app
docker exec -ti $app bash

You can now proceed with the BIND v9 guide.

Note however that you don’t need to chroot the thing since you are already isolating the process in a docker container,

cd /etc/
mv named.conf named.conf.dist
vi named.conf

        allow-query             { any; };
        allow-query-cache       { any; };

cd /var/named/
vi example.local.db
vi 2.168.192...db

named-checkconf -z /etc/named.conf
/usr/sbin/named -u named

rndc reload
#pgrep named
#kill -HUP `pgrep named`

rndc stop
#pgrep named
#kill -TERM `pgrep named`

Once you’re done, write a new init.bash and commit the container to an image.