This Docker image is suitable for running a DNS server for your docker host network. It uses the bind9 server which is bundled with the latest Ubuntu LTS distribution.
./build to create the local docker image prehley/bind9.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.
etcbind folder.etcbind/named.conf with a dns configuration.varbindvarbind/domain.com.zone and varbind/domain.com.rev.zone with zone configuration.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 bind9 --net=host -v "$(pwd)/etcbind":/etc/bind -v "$(pwd)/varbind":/var/lib/bind prehley/bind9 /bin/bash
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.
This image uses the following software components:
The prehley/bind9 project is copyright 2018 Peter Rehley [email protected]
It is licensed under the MIT License
See the file LICENSE for full legal details.
Content type
Image
Digest
Size
63.4 MB
Last updated
over 8 years ago
docker pull prehley/bind9