Install with Docker
The image is ghcr.io/operomtl/opdns-node, for linux/amd64 and
linux/arm64. It contains the static node binary and Alpine’s Unbound,
which the node starts and supervises. It runs as an unprivileged user that
can bind port 53. Data lives in the volume at /var/lib/opdns.
Each release gets a tag with its version (v1.2.3), and that tag never
moves. v1.2 and v1 follow the newest release of that line. latest
follows the newest stable release. Pre-releases, such as v1.3.0-rc1, move
none of these tags. For anything important, pin a version or a digest.
The linux/amd64 image is about 35 MB compressed (86 MB unpacked).
Free port 53
Section titled “Free port 53”On many Linux distributions, systemd-resolved listens on
127.0.0.53:53. This conflicts with publishing port 53 on all addresses.
Publish on the LAN address only (-p 192.168.1.10:53:53/udp), or turn off
the stub listener of systemd-resolved:
[Resolve]DNSStubListener=noThen run sudo systemctl restart systemd-resolved.
If another program still uses port 53, the node refuses to start. When the
node can see that program (a binary install, or a container on the host
network), its log names it, for example
dnsmasq (pid 733) holds port 53/tcp. The log also gives the fix for that
program. For dnsmasq, port=0 in its configuration keeps its DHCP and
turns off its DNS. You must stop another Pi-hole or DNS server, or move it
to another address. On the host, sudo ss -lunpt 'sport = :53' shows the
same information.
Run it
Section titled “Run it”The Nodes → Add a node dialog in the dashboard shows this command, with your enrollment code filled in. See Enroll a node.
docker run -d --name opdns-node --restart unless-stopped --read-only \ -p 53:53/udp -p 53:53/tcp \ -p 127.0.0.1:8053:8053 \ -v opdns-node:/var/lib/opdns \ -e OPDNS_ENROL_TOKEN=<enrolment-code> \ ghcr.io/operomtl/opdns-node:<version>Save this as compose.yaml in an empty directory. It runs without
changes, with host networking (why):
# opdns-node with Docker Compose, host networking: the recommended way to# run the self-hosted node in a container.## OPDNS_NODE_TAG=<version> OPDNS_ENROL_TOKEN=<code> docker compose up -d## Port 53 must be free on the host: turn off systemd-resolved's stub# listener first (DNSStubListener=no) if it holds 127.0.0.53:53.services: opdns-node: # Pin a release (vX.Y.Z, or vX.Y for its patches) for anything you care # about; set OPDNS_NODE_TAG in .env. `latest` is the newest stable one. image: ghcr.io/operomtl/opdns-node:${OPDNS_NODE_TAG:-latest} restart: unless-stopped network_mode: host read_only: true # The binary binds port 53 through its file capability: keep # NET_BIND_SERVICE, drop the rest. no-new-privileges would disable that # file capability, so it is not set. cap_drop: [ALL] cap_add: [NET_BIND_SERVICE] volumes: - opdns-node:/var/lib/opdns environment: # Used once, on first start; the identity is then in the volume. OPDNS_ENROL_TOKEN: ${OPDNS_ENROL_TOKEN:-} # The status page on the host's loopback only (the image's default, # 0.0.0.0:8053, would put it on the LAN with host networking). OPDNS_PAGE_ADDR: 127.0.0.1:8053 # Shown on the status page and in /api/status (versions.image). OPDNS_IMAGE: ghcr.io/operomtl/opdns-node:${OPDNS_NODE_TAG:-latest}volumes: opdns-node:Then, in the same directory:
OPDNS_NODE_TAG=<version> OPDNS_ENROL_TOKEN=<enrolment-code> docker compose up -dHost, bridge or macvlan networking
Section titled “Host, bridge or macvlan networking”The node needs the real source address of each client. It names devices by that address and records it in the query log. Its open-resolver guard (the filter that refuses queries from outside your network) answers only LAN sources.
- Host networking (
network_mode: host,docker run --network host) is the recommended mode. The node sees every source address, IPv4 and IPv6. It also sees its own interfaces, which the IPv6 egress test needs. Port 53 must be free on the host. With host networking, setOPDNS_PAGE_ADDR=127.0.0.1:8053, as the Compose file does. If you do not, the status page is on the LAN. - Bridge networking with published ports (
-p 53:53/udp, thedocker runline in the dashboard) keeps the source address only while Docker forwards with iptables DNAT (rootful Docker on Linux, IPv4). Sometimes the userland proxy of Docker forwards instead: IPv6 withoutip6tables, rootless Docker or Podman, and Docker Desktop on macOS and Windows. Then every query arrives from the bridge gateway (172.17.0.1). All devices become one client, and the query log shows that address. The guard admits everything, because that gateway is a private address. To test, query the node from a LAN device. Then look at the client address of that query in the query log of the dashboard. If it is the gateway, switch to host networking. - macvlan gives the container its own address on the LAN. The node then sees source addresses as with host networking, and port 53 on the host stays with another program (systemd-resolved, or a Pi-hole that you are replacing). Use the Compose file below. The host itself cannot reach a macvlan container over that interface.
For macvlan, save this as compose.macvlan.yaml. Set the parent interface,
the subnet, the gateway and the address of the node for your network:
# opdns-node with Docker Compose on a macvlan network: the node gets its# own address on the LAN, so it sees every client's real source address# and port 53 on the host can stay with another program.## OPDNS_ENROL_TOKEN=<code> OPDNS_LAN_IF=eth0 OPDNS_LAN_SUBNET=192.168.1.0/24 \# OPDNS_LAN_GATEWAY=192.168.1.1 OPDNS_NODE_ADDR=192.168.1.53 \# docker compose -f compose.macvlan.yaml up -d## Pick OPDNS_NODE_ADDR outside the router's DHCP pool, and point the# router's DHCP DNS server at it. A macvlan container cannot talk to its own# host over that interface (a kernel rule): the host itself resolves through# something else, or through a macvlan sub-interface on the host. The# status page listens on the node's address (port 8053), open to the LAN# sources its allowlist admits: set a page password.services: opdns-node: image: ghcr.io/operomtl/opdns-node:${OPDNS_NODE_TAG:-latest} restart: unless-stopped read_only: true cap_drop: [ALL] cap_add: [NET_BIND_SERVICE] networks: lan: ipv4_address: ${OPDNS_NODE_ADDR:-192.168.1.53} volumes: - opdns-node:/var/lib/opdns environment: OPDNS_ENROL_TOKEN: ${OPDNS_ENROL_TOKEN:-} OPDNS_IMAGE: ghcr.io/operomtl/opdns-node:${OPDNS_NODE_TAG:-latest}networks: lan: driver: macvlan driver_opts: parent: ${OPDNS_LAN_IF:-eth0} ipam: config: - subnet: ${OPDNS_LAN_SUBNET:-192.168.1.0/24} gateway: ${OPDNS_LAN_GATEWAY:-192.168.1.1}volumes: opdns-node:With macvlan the status page is on the LAN: set a page password.
The status page and /api/status (versions.image) show OPDNS_IMAGE.
Set it to the image that you run, preferably with its digest
(ghcr.io/operomtl/opdns-node:v1.2.3@sha256:…). A container cannot read
the digest of its own image.
The node installs a list artifact (the signed file of filter lists) only if
its Ed25519 signature verifies. You do not have to configure the key. By
default (lists.trust_cloud_key: true), an enrolled node learns the key
from the cloud on every profile pull. It keeps the key in
lists_keys.json in the volume. After a restart, it can then verify lists
without the internet. To pin keys yourself instead, set
OPDNS_LISTS_PUBLIC_KEYS and OPDNS_LISTS_TRUST_CLOUD_KEY=false
(list signing keys).
The node uses OPDNS_ENROL_TOKEN once, on first start. After that, the
identity of the node is in the volume, and the node ignores the variable.
You can safely leave it in the Compose file. The code works only once and
expires after 15 minutes.
A container does not serve DNS if it has no enrollment code, no existing
identity in its volume and no standalone profile. It prints how to enroll
and exits with status 2. With --restart unless-stopped, it keeps
restarting and printing the same message until you add the code.
Check it
Section titled “Check it”- Run
docker logs opdns-node. It shows the enrollment and “loaded” lines. - Run
docker exec opdns-node opdns-node status. It prints the mode, the node id, the profile, the link state and the versions. - On the host, open
http://127.0.0.1:8053/for the status page. - Run
dig @<host-address> example.com. It gets an answer. - Open the Nodes page in the dashboard. It shows the node online.
The image has a health check on /healthz. When Unbound answers and a
profile and lists are loaded, docker ps shows the container as
healthy.
Point your network at it
Section titled “Point your network at it”Set the DHCP DNS server of your router (option 6) to the LAN address of the node. If you use IPv6, also set IPv6 RDNSS. Queries from every device then go to the node.
Encrypted DNS on the node
Section titled “Encrypted DNS on the node”By default, the node listens for plain DNS. For DNS-over-TLS, DoH, DoQ or DoH3 on your LAN, give it a certificate for a name that your devices use. Then set the listeners, for example:
ports: - "853:853/tcp" - "443:443/tcp" volumes: - opdns-node:/var/lib/opdns - /etc/letsencrypt/live/dns.home.example:/certs:ro environment: OPDNS_LISTEN_DOT: ":853" OPDNS_LISTEN_DOH: ":443" OPDNS_LISTEN_TLS_CERT: /certs/fullchain.pem OPDNS_LISTEN_TLS_KEY: /certs/privkey.pem OPDNS_LISTEN_DNS_DOMAIN: dns.home.exampleA certificate renewal needs no restart. Every second, the node reads the
certificate and key files. When the pair changes, the node loads the new
pair at once. If a pair fails to load, the node logs it and keeps the
previous certificate. Connections that are already open keep the
certificate that they started with. docker kill -s HUP opdns-node forces
a reload. It also pulls the profile and lists again and applies the
reloadable configuration keys.
The log says certificate reloaded, with the new expiry date.
Every key is on the configuration reference.