fix: symlink /etc/dns to /config/dns at build time, drop entrypoint

rm -rf the real /etc/dns dir before symlinking so it replaces rather
than nests. Technitium now writes directly to the persistent
addon_config mount — no entrypoint shim needed.
This commit is contained in:
2026-08-08 07:36:58 -04:00
parent c791135a59
commit ed54778a0d
3 changed files with 5 additions and 28 deletions

View File

@@ -1,10 +1,9 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base:latest
FROM technitium/dns-server:latest FROM technitium/dns-server:latest
ENV DNS_SERVER_WEB_SERVICE_HTTPS_PORT=53443 \ ENV DNS_SERVER_WEB_SERVICE_HTTPS_PORT=53443 \
DNS_SERVER_WEB_SERVICE_ENABLE_HTTPS=false DNS_SERVER_WEB_SERVICE_ENABLE_HTTPS=false
COPY entrypoint.sh /entrypoint.sh # Technitium hardcodes /etc/dns as its config dir. HA's addon_config mounts
RUN chmod +x /entrypoint.sh # at /config (persistent). Replace the real dir with a symlink so Technitium
# writes through to the persistent volume.
ENTRYPOINT ["/entrypoint.sh"] RUN rm -rf /etc/dns && mkdir -p /config/dns && ln -s /config/dns /etc/dns

View File

@@ -1,5 +1,5 @@
name: Technitium DNS name: Technitium DNS
version: 15.4.3 version: 15.4.4
slug: technitium_dns slug: technitium_dns
description: Technitium DNS Server add-on for Home Assistant description: Technitium DNS Server add-on for Home Assistant
arch: arch:

View File

@@ -1,22 +0,0 @@
#!/bin/sh
set -e
# Technitium ships /etc/dns as a real directory in the image. We need it
# to point at the persistent HA add-on config volume instead. Remove the
# directory and replace with a symlink at runtime (after HA mounts volumes).
DATA="/config/dns"
mkdir -p "$DATA"
if [ -d /etc/dns ] && [ ! -L /etc/dns ]; then
# Seed: copy any existing default config into the volume on first run
if [ -z "$(ls -A "$DATA" 2>/dev/null)" ]; then
cp -a /etc/dns/. "$DATA"/
fi
rm -rf /etc/dns
fi
ln -sf "$DATA" /etc/dns
exec dotnet DnsServerApp.dll