Docker containers lose DNS or internet with Tailscale: the fixes
Docker containers can't resolve names or reach the internet after Tailscale? An exit node without LAN access or stateful filtering. How to tell, and the fix.
On a Linux server, Tailscale breaks Docker containers in two separate ways. If the server uses an exit node, Tailscale routes every local subnet into the tunnel, Docker’s bridge networks included, so containers lose the internet while the host keeps it: run sudo tailscale set --exit-node-allow-lan-access=true. If the server is a subnet router or exit node with stateful filtering on, Tailscale warns “Stateful filtering is enabled and Docker was detected; this may prevent Docker containers on this host from resolving DNS and connecting to Tailscale nodes.” Containers send their DNS to Tailscale’s resolver at 100.100.100.100, and the filter drops it: run sudo tailscale set --stateful-filtering=false. Stateful filtering has been off by default since Tailscale 1.66.4 (May 2024), so it is only on if someone turned it on.
Which of the two you have
The host itself working while its containers fail is the shape of both. Two reads tell them apart:
tailscale status | grep -A3 'Health check'
ip route show table 52Copied- A health line naming stateful filtering and Docker is the second case. It only appears on a server that advertises routes or offers itself as an exit node.
- A line such as
172.17.0.0/16 dev tailscale0in table 52 is the first. Table 52 is where Tailscale on Linux keeps its routes, and with an exit node set and LAN access off, the server’s Docker subnets sit there beside the default route.ip route get 172.17.0.2then answersdev tailscale0 table 52instead ofdev docker0. Tailscale and WireGuard on one machine walks through reading Tailscale’s routing rules if you need more than this.
On Tailscale 1.100 or later, tailscale get prints the two settings directly:
tailscale get stateful-filtering
tailscale get exit-node-allow-lan-accessCopiedIf the host cannot reach the internet either, neither case is the cause. A server pointed at an exit node it is not allowed to use loses everything; a tailnet policy narrowed for an agent’s server needs a grant to autogroup:internet before the server can use an exit node at all.
Containers on a server that uses an exit node
When an exit node is set, Tailscale adds a route for every network the server is directly attached to. In its client source (1.104.7, November 2026), those routes stay local only if --exit-node-allow-lan-access is on; otherwise they go into the tunnel, so that traffic for the local network does not leak around the exit node. On Linux only loopback is exempt. Docker’s default bridge, docker0, and the bridge each Compose project creates for itself are ordinary local networks to Tailscale, so their subnets are sent to tailscale0.
The effect is that a container’s packets still leave, but the replies addressed to the container’s 172.x address are routed into the tunnel instead of back to the bridge. That is what a user found in tailscale/tailscale#3877, “Docker breaks when Tailscale configured to use an exit node”, open since February 2022: replies to 172.17.0.x went out through tailscale0 rather than docker0. The host reaching its own containers by address is cut off the same way.
The fix most often confirmed in that thread is the setting Tailscale’s exit node docs describe for the local network, which is off by default (“the device connecting to an exit node won’t have access to its local network”):
sudo tailscale set --exit-node-allow-lan-access=trueCopiedInternet traffic from the host and the containers still leaves through the exit node; only the directly attached networks are kept local. On a cloud server those include the provider’s private network if the server is on one, which is the trade Tailscale’s docs mean when they say LAN access “exposes you to potentially untrusted devices in the network.” If the server uses an exit node to give an agent’s browser a home address, as in the exit node guide, this setting belongs in the same setup.
Two more things from the thread, as users reported them. Two set Docker’s MTU to 1280, the MTU Tailscale gives its own interface, with "mtu": 1280 in /etc/docker/daemon.json (Docker’s --mtu sets the default bridge’s MTU, 1500 by default) or on a network of their own; whether that helps beyond the LAN setting is not settled there. One user needed tailscale down and tailscale up before the change took, and another found the cause was an exit node set months earlier and forgotten, which tailscale set --exit-node= clears.
The stateful filtering warning
The message comes from Tailscale’s Linux router and is set only when three things hold: stateful filtering is on, the server advertises routes (a subnet router, or an exit node, whose default route counts), and an interface named docker0 exists. That is the whole Docker check, so a host whose containers run under another runtime never sees the warning even if it has the problem. It shows under “# Health check:” in tailscale status, and its link leads to Tailscale’s page for the message.
Stateful filtering makes a subnet router or exit node drop packets bound for other tailnet devices unless they belong to a connection that device opened. The DNS breakage was explained by a maintainer in #12108, “Tailscale >= 1.66.0 breaks DNS name resolution in Docker containers on Linux”: Docker hands containers the host’s nameservers, on a Tailscale host that is 100.100.100.100, which lives on tailscale0, and a query arriving from a container’s 172.17.0.x address looks to the filter like an unsolicited packet from another host, so it is rejected. Connections from containers to other tailnet devices fail for the same reason.
The setting arrived in 1.66.0 (May 2024) as a mitigation for the security issue TS-2024-005, with a release note that it “can break existing setups that depend on forwarding connections from external hosts (internet, LAN, Docker containers, etc.) into the tailnet.” Thirteen days later 1.66.4 turned it off by default: the setting, its release note says, “inadvertently broke DNS resolution from containers running on the host,” and that most vulnerable setups were already protected “except when autogroup:danger-all is used in ACLs.” In 1.104.7 the flag still defaults to false. So if you see the warning today, it was turned on with --stateful-filtering, and the question is whether your tailnet policy uses autogroup:danger-all. If it does not, turning it off returns the server to Tailscale’s default:
sudo tailscale set --stateful-filtering=falseCopiedUsers in #12108 reported it working without a restart. Of the other fixes Tailscale’s page lists, turning off Docker’s iptables management is the one to avoid on an ordinary server: Docker’s own firewall docs call it “not appropriate for most users” and say it “is likely to break container networking”, since containers then lose the masquerading that gives them the internet.
Why containers ask 100.100.100.100 at all
A container does not use the host’s 127.0.0.53 or any other loopback resolver, because loopback inside the container is the container’s own. Docker’s networking docs say containers on the default bridge get a copy of the host’s /etc/resolv.conf, and containers on a Compose or other user-defined network use Docker’s embedded server at 127.0.0.11, which forwards to the host’s DNS servers. Docker’s source fills in the rest: when the host’s file names only 127.0.0.53 (systemd-resolved), Docker reads /run/systemd/resolve/resolv.conf instead, and when no non-loopback server is left at all it falls back to 8.8.8.8 and 8.8.4.4. On a host where Tailscale manages DNS, those servers can include 100.100.100.100, which is the case the maintainer described in #12108. To see what a container actually got:
docker exec <container> cat /etc/resolv.conf
cat /run/systemd/resolve/resolv.confCopiedTwo consequences. With stateful filtering off and no exit node in the way, containers can use 100.100.100.100, and MagicDNS names of your other devices resolve inside them; one user in #12108 reported full MagicDNS names working with 100.100.100.100 set as the containers’ DNS. And if a container needs only the public internet, giving it public resolvers sidesteps Tailscale entirely, at the cost of tailnet names. Docker takes them per service in Compose or for every container in /etc/docker/daemon.json:
# compose.yaml, under the service
dns:
- 1.1.1.1
- 9.9.9.9
# /etc/docker/daemon.json (add the key to what is there),
# then restart Docker
{ "dns": ["1.1.1.1", "9.9.9.9"] }CopiedChanging DNS does not fix the exit-node case: there the replies to the container are misrouted whatever server it asks. One #12108 user with a Mullvad exit node still had broken containers after turning stateful filtering off, which fits that case.
An agent in a container on such a server
An AI agent run in Docker, whether a harness’s own Compose install or a coding agent in a dev container, meets this as calls to its model API failing with name-resolution errors or timeouts, often right after Tailscale was installed or an exit node was set, while curl from the host works. Nothing inside the container can fix it: the routes and the filter are the host’s, so the change is made on the host with the commands above, and the agent’s next request is the test. What a container is and where its network comes from is in what a Docker container is.