Fixing AdGuard access for other containers – what does the "Host Network" setting do?

For a few weeks, I’ve failed to get Outline working with PocketID as the OIDC. Today, I finally solved the problem after quite a few rounds with ChatGPT.

Turns out that the problem wasn’t with PocketID or Outline per se, but that the AdGuard container I am using as local DNS couldn’t be reached by neither of them. When I enabled the setting for “Host Network” in AdGuard’s config, I was finally able to login to Outline using PocketID.

That’s nice, of cource. But since I’m new to the world of Docker and TrueNAS, I would also like to understand why that solved the problem, why the UI advice against activating it, and if there is a better way to let other containers send DNS queries to AdGuard?

In the world of docker, each docker container gets their own internal docker network and you access it by port forwarding ports from the host ip to the internal docker ip. If you choose host network, the docker container gets placed directly on the host ip. This would prevent multiple apps from accessing the same port (lets say 80). If multiple apps have their web interface on port 80 they would fail to start because it may be already in use. With docker networks you simply can port forward different ports to the internal port 80.

Usually for container to communicate with each other you’d place them on the same docker network so they can communicate with each other. This is currently not possible with truenas apps, without using the cli or other management means like portainer.

1 Like

So the reason it works when I enable Host Network for my AdGuard container is that

a) I already have moved TrueNAS’ GUI of to port 880 and port 8443 so no collision there
b) Port 53 is reserved for DNS

So there is no downside leaving that enabled?

in 25.04. incus uses port 53 for dns resolution. You can move incus from port 53 with

sudo incus network set incusbr0 raw.dnsmasq="port=5354"

that should let you use adguard withous host network