Skip to content
Kaiov0.8.0

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.

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:

Terminal window
sudo mkdir -p /etc/systemd/resolved.conf.d
sudo tee /etc/systemd/resolved.conf.d/adguardhome.conf <<'EOF'
[Resolve]
DNS=127.0.0.1
DNSStubListener=no
EOF
sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl reload-or-restart systemd-resolved

DNS=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.

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.
  • conf holds AdGuardHome.yaml, the whole configuration with the admin account; work holds the query log, the statistics and the downloaded filter lists.
ADGUARD_TAG=v0.107.80
Terminal window
kaio-cli stack deploy adguard ./compose.yml --env-file .env
kaio-cli stack logs adguard --follow

Open 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:

Terminal window
dig @192.168.1.10 example.com

AdGuard Home’s own updater is disabled in Docker: the image is what moves.

Terminal window
kaio-cli stack check-update adguard # compares digests, pulls nothing
kaio-cli stack env set adguard ADGUARD_TAG=<next-release>
kaio-cli stack apply adguard
kaio-cli stack rollback adguard 1

A 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.

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:

Terminal window
kaio-cli stack deploy adguard ./compose.yml --env-file .env --accept-risks
Stack 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.

Terminal window
kaio-cli stack copy adguard --to prod-02 --with-volumes

The 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