AdGuard Home
AdGuard Home is a DNS server that blocks ads and trackers for every device that uses it. It is a small stack with two things to get right: port 53 on the host, and whether it also hands out addresses over DHCP, which changes what it needs from the host.
1. Free port 53
Section titled “1. Free port 53”On a host running systemd-resolved, its stub listener already holds
127.0.0.53:53 and the deploy fails to bind the port. Turn the listener off, as
AdGuard’s FAQ describes:
sudo mkdir -p /etc/systemd/resolved.conf.dsudo tee /etc/systemd/resolved.conf.d/adguardhome.conf <<'EOF'[Resolve]DNS=127.0.0.1DNSStubListener=noEOFsudo mv /etc/resolv.conf /etc/resolv.conf.backupsudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.confsudo systemctl reload-or-restart systemd-resolvedDNS=127.0.0.1 makes the host itself resolve through AdGuard Home once it
runs. Until then the host has no resolver, so deploy right after.
2. Write the Compose file
Section titled “2. Write the Compose file”services: adguard: image: docker.io/adguard/adguardhome:${ADGUARD_TAG:-latest} restart: unless-stopped ports: - "53:53/tcp" - "53:53/udp" - "127.0.0.1:3000:3000/tcp" - "127.0.0.1:8053:80/tcp" volumes: - work:/opt/adguardhome/work - conf:/opt/adguardhome/conf
volumes: work: conf:- Port 53 is the DNS server, published on every interface so the network can
use it. On a host reachable from the Internet, publish it on the LAN address
only (
192.168.1.10:53:53/udp), or it becomes an open resolver anyone can use. - Port 3000 serves the setup wizard, and port 80 inside the container the admin panel once set up. Both stay on the loopback, for a reverse proxy or an SSH tunnel.
confholdsAdGuardHome.yaml, the whole configuration with the admin account;workholds the query log, the statistics and the downloaded filter lists.
ADGUARD_TAG=v0.107.803. Deploy it and run the wizard
Section titled “3. Deploy it and run the wizard”kaio-cli stack deploy adguard ./compose.yml --env-file .envkaio-cli stack logs adguard --followOpen http://localhost:3000 and follow the wizard. When it asks for the admin
web interface, keep it on port 80: that is the container port mapped to
127.0.0.1:8053 above. From then on the panel answers on
http://localhost:8053. Point your router’s DHCP at the host’s address as the
DNS server, and the devices on the network start filtering.
Check it from another machine:
dig @192.168.1.10 example.com4. Keep it up to date
Section titled “4. Keep it up to date”AdGuard Home’s own updater is disabled in Docker: the image is what moves.
kaio-cli stack check-update adguard # compares digests, pulls nothingkaio-cli stack env set adguard ADGUARD_TAG=<next-release>kaio-cli stack apply adguardkaio-cli stack rollback adguard 1A pinned tag makes each upgrade a version you can roll back to; latest with
stack update works too, and Kaio flags the stack when the digest behind it
moves. Either way the new image is pulled before the container is recreated,
so the resolver keeps answering while it downloads, and the network loses DNS
only for the seconds the container takes to restart.
The DHCP variant
Section titled “The DHCP variant”To let AdGuard Home hand out addresses as well, replacing the router’s DHCP server, the container has to see the broadcasts on the LAN, which means the host’s network:
services: adguard: image: docker.io/adguard/adguardhome:${ADGUARD_TAG:-latest} restart: unless-stopped network_mode: host volumes: - work:/opt/adguardhome/work - conf:/opt/adguardhome/conf
volumes: work: conf:With network_mode: host there are no ports to publish: AdGuard Home binds 53,
67, 3000 and its admin port on the host directly, every interface included, so
set the admin panel to 127.0.0.1 in the wizard.
Kaio reads that line for what it is, and refuses the deploy until it is run
again with --accept-risks:
kaio-cli stack deploy adguard ./compose.yml --env-file .env --accept-risksStack adguard deployment started.warning: adguard shares the host's network namespace (network_mode: host)The stack carries the HOST ACCESS mark, every later
stack apply or stack rollback needs --accept-risks too, and through MCP an
apply, a rollback or a copy needs accept_risks. That is the honest cost of
DHCP: the container sees every interface and every port of the host. If the
router can keep doing DHCP, the first file, which carries no mark, is the
better one.
Moving it
Section titled “Moving it”kaio-cli stack copy adguard --to prod-02 --with-volumesThe configuration, the filters and the statistics move with the volumes. The devices do not follow on their own: they ask the old address until the router hands out the new one as DNS server.
Kaio, built by Régis Gaidot