Unbound Docker for Raspberry Pi

repository·master·Indexed 41 days ago

https://github.com/matthewvance/unbound-docker-rpi

A Docker image for running Unbound, a validating, recursive, and caching DNS resolver, optimized for Raspberry Pi (ARM) with the latest OpenSSL. Supports custom A, PTR, and SRV records, as well as custom DNS forwarders via configuration file mounts.

Tokens
1.2K
Snippets
6
Records
6
Agent score
2%

What's inside Unbound Docker RPi

  1. Serve custom A and PTR records for a local network

    master

    You can use Unbound to resolve custom local names (e.g., laptop.local) by providing an a-records.conf file. This file supports both A records (forward resolution) and PTR records (reverse resolution).

    Example a-records.conf format:

    # A Record
    local-data: "laptop.local. A 192.168.1.2"
    
    # PTR Record
    local-data-ptr: "192.168.1.2 laptop.local."

    Mount this file to /opt/unbound/etc/unbound/a-records.conf when starting the container.

    docker run \
    --name=unbound-rpi \
    --volume=$(pwd)/a-records.conf:/opt/unbound/etc/unbound/a-records.conf:ro \
    --publish=53:53/udp \
    --publish=53:53/tcp \
    --restart=unless-stopped \
    --detach=true \
    mvance/unbound-rpi:latest
  2. Use a fully customized Unbound configuration

    master

    To completely bypass the default configuration and use your own unbound.conf, mount your configuration directory to /opt/unbound/etc/unbound/. This exposes all files in your local directory to the container. You can then use Unbound's include directive within your unbound.conf to segment your configuration (e.g., include: /opt/unbound/etc/unbound/local-zone-unbound.conf).

    docker run --name=unbound-rpi \
    --volume=/my-directory/unbound:/opt/unbound/etc/unbound/ \
    --publish=53:53/tcp \
    --publish=53:53/udp \
    --restart=unless-stopped \
    --detach=true \
    mvance/unbound-rpi:latest
  3. Override default DNS forwarders

    master

    By default, the image uses Cloudflare DNS. To use your own upstream DNS servers, create a forward-records.conf file and mount it to /opt/unbound/etc/unbound/forward-records.conf as a read-only volume.

    Example forward-records.conf content:

    forward-zone:
      name: "."
      forward-addr: 192.168.0.1@53#home.local
    docker run \
    --name=my-unbound \
    --volume=$(pwd)/forward-records.conf:/opt/unbound/etc/unbound/forward-records.conf:ro \
    --publish=53:53/udp \
    --publish=53:53/tcp \
    --restart=unless-stopped \
    --detach=true \
    mvance/unbound-rpi:latest
  4. Append customizations to the default Unbound configuration

    master

    If you want to keep the default configurations generated by the unbound.sh script but add your own files, mount a directory to /opt/unbound/etc/unbound/. This uses a wildcard include feature (available in version 1.13.0+) to load additional configuration files from that directory.

    docker run --name=unbound-rpi \
    --volume=/my-directory/unbound:/opt/unbound/etc/unbound/ \
    --publish=53:53/tcp \
    --publish=53:53/udp \
    --restart=unless-stopped \
    --detach=true \
    mvance/unbound-rpi:latest
  5. Install and run Unbound DNS Server on Raspberry Pi

    master

    To run the standard Unbound DNS server on a Raspberry Pi using Docker, pull the mvance/unbound-rpi:latest image and run it with UDP and TCP ports 53 published. The container is configured to restart unless stopped.

    docker pull mvance/unbound-rpi:latest
    
    docker run \
    --name=unbound-rpi \
    --publish=53:53/udp \
    --publish=53:53/tcp \
    --restart=unless-stopped \
    --detach=true \
    mvance/unbound-rpi:latest
  6. Serve custom SRV records

    master

    To provide SRV records for service discovery on your local network, create a srv-records.conf file and mount it to /opt/unbound/etc/unbound/srv-records.conf as a read-only volume.

    Example srv-records.conf format:

    # _service._proto.name. | TTL | class | SRV | priority | weight | port | target.
    _etcd-server-ssl._tcp.domain.local.  86400 IN    SRV 0        10     2380 etcd-0.domain.local.
    docker run \
    --name my-unbound \
    --volume=$(pwd)/srv-records.conf:/opt/unbound/etc/unbound/srv-records.conf:ro \
    --publish=53:53/udp \
    --publish=53:53/tcp \
    --restart=unless-stopped \
    --detach=true \
    mvance/unbound-rpi:latest