One container that speaks BGP and answers DNS

The APN DNS image is an FRR base image with a CoreDNS binary dropped into it, which sounds like laziness and was in fact the whole point.

Containers

It started as a template for something else

The repository was scaffolded from the standard service template. Its first Dockerfile was FROM haproxy:lts-alpine, and its haproxy.cfg (22 lines) returned the string "Hello from HAProxy" on port 8080. The commit that made it a DNS service deleted that file, deleted the template's refactorAsServiceName target, and replaced the base image. Only one commit, and 13 files: 105 insertions against 115 deletions (PR #1, 29 October 2024). It stands in for the Partner D DNS containers it was built to replace.

The base image is the one the DRA images already use, pinned by digest:

ARG BASE_IMAGE=registry.internal/infra/cr-frr:frr-stable-jammy@sha256:5e23a0dc…
FROM ${BASE_IMAGE} AS prod

That choice carries three things for free (BGP, a working s6 supervision tree, the rsyslog wiring). A partner-facing DNS server has to advertise its own service address into the signalling fabric, so it needs a routing daemon in the same network namespace. Running FRR beside CoreDNS in one container is cheaper than coordinating two; one namespace, one restart, one health check.

Two ports, one of them the reason

EXPOSE 11915/tcp
EXPOSE 53 53/udp

Port 53 is the service (TCP and UDP both, since NAPTR answers outgrow 512 bytes). 11915 is the metrics endpoint, and exposing it explicitly is what registers the service for discovery (Consul picks it up from the image). The comment in the Dockerfile says so, because the reason is not guessable from the line.

The CoreDNS install is a tarball fetch instead of a package, with a comment I still stand behind:

# because of stupidity of Dockerfile we cannot expand ARG twice in the same command

ARG VERSION="1.11.3" is copied into ENV COREDNS_VERSION. The download line then uses $COREDNS_VERSION in the URL path and ${VERSION} in the filename — both forms in one RUN, because neither expands twice.

Turning the base image's init off, then doing it again

The base image sets up hostname and addresses itself. Both are disabled (CONTAINER_ROUTER_SKIP_SET_HOSTNAME=true, CONTAINER_ROUTER_SKIP_IP_ADD=true) and redone in a twelve-line init script. The names and the service address come from environment variables the deployment sets:

sysctl -p
hostname ${SERVER_HOSTNAME}.${ENV}
ip addr add ${EXTERNAL_SIGNALLING_IP}/32 dev eth0

The BGP side is a template rendered at startup. It is an iBGP session to the signalling router (remote-as equals the site ASN), with advertisement-interval 1 and timers 3 12 for fast withdrawal. It advertises {{ .EXTERNAL_SIGNALLING_IP }}/32 and nothing else; the host route is what lets the address move with the container. All three RFC1918 blocks get static routes back through the internal bridge (10/8, 172.16/12, 192.168/16).

CoreDNS runs as an s6 service that waits on rsyslog before it execs, so startup messages survive (s6-svc -wu, then a one-second sleep). Its finish script runs s6-svscanctl -t on the service tree, so a CoreDNS exit brings the whole container down; the supervisor only ever tears down, never restarts in place. That is deliberate, not an oversight. A DNS server that has stopped answering should be replaced by the host's restart policy, never quietly revived in place by its own supervisor.

What testing actually looked like

test:
    @echo 'Test is performed in the base FRR and external CoreDNS images'

Two upstream components and no glue to test is a defensible position for a 30-line Dockerfile (nothing in it is compiled here). It stopped being defensible later — and the interesting part is why.

The service moved to BIND in November 2025, then came back to CoreDNS in February 2026. This time it is built from vendored source, because two plugins are missing from the release binary. naptr_loadbalance shuffles NAPTR records per query in "single" mode, returning one record per answer, since resolver caching defeats ordinary round-robin. rrl rate-limits at 20 responses/sec per client /24 with slip-ratio 2 (amplification protection; these servers face the roaming interconnect). A local run of 100 NAPTR queries gave a 49/51 split across the two gateway nodes, one record per response.

One more thing bit after that. The prometheus plugin only instruments the server block it is declared in. With it in the root block alone, the zone counters never reached Grafana — five lines per zone block, three deployments, one sentence of explanation in the commit.