Sign inSign up

prehley/rpi-bind9

By prehley

•Updated over 8 years ago

Docker image for dns/named running on raspberry pi

Image
1

441

prehley/rpi-bind9 repository overview

This Docker image is suitable for running a DNS server for your docker raspberry pi host network. It uses the bind9 server which is bundled with the latest raspbian distribution.

⁠How to build

  1. Install Docker with the instructions on https://www.docker.com⁠.
  2. Clone the github repository https://github.com/prehley/bind9.git⁠
  3. Check out the rpi branch
  4. Run ./build to create the local docker image prehley/rpi-bind9.

⁠How to use

The most common use-case is to provide DNS service to the host network of the machine running Docker. For that you need to create a configuration for the DNS server, start the container with the --net=host docker run option and specify the network interface you want to provide DNS service on.

  1. Create etcbind folder.
  2. Create etcbind/named.conf with a dns configuration.
  3. Create varbind
  4. Create varbind/domain.com.zone and varbind/domain.com.rev.zone with zone configuration.
  5. Run docker run -it --rm --name bind9 --net=host -v "$(pwd)/etcbind":/etc/bind -v "$(pwd)/varbind":/var/lib/bind prehley/bind9 named. You can press Ctrl-C to terminate the server.

A simple run script is also included which makes it quick to iterate on a configuration until you're satisfied.

It's also possible to launch a bash shell to ease testing. Use the following command docker run -it --rm --name rpi-bind9 --net=host -v "$(pwd)/etcbind":/etc/bind -v "$(pwd)/varbind":/var/lib/bind prehley/rpi-bind9 /bin/bash

⁠Notes

The entrypoint script in the docker image takes care of running the DNS server as the same user that owns the etcbind folder. This ensures that the permissions on the files inside the etcbind folder is kept consistent. If the etcbind folder is owned by root, named is run as the normal bind user.

If you forget to run the docker container with the --net=host option a warning will be emitted informing you that you've probably forgotten it.

If a /etc/bind volume is not provided with a named.conf inside it, the container will exit early with an error message.

⁠Acknowledgements

This image uses the following software components:

The prehley/rpi-bind9 project is copyright 2018 Peter Rehley [email protected]⁠

It is licensed under the MIT License

See the file LICENSE for full legal details.

Tag summary

Content type

Image

Digest

Size

59.7 MB

Last updated

over 8 years ago

docker pull prehley/rpi-bind9