You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: using system dns occasionally causes all network egress to fail #1241
If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Apologies for not having a solid repro
Current behavior
I'm setting the network route for containers to reach localhost servers with:
sudo container system dns create host.containers.internal --localhost 203.0.113.113
But occasionally, and randomly, this puts the network into a state where all DNS breaks and I can not egress from the containers. ('curl google.com' fails)
Sometimes this is transient and will start working again
More often than not I have to stop/start the services and then delete and recreate the DNS entry in the container system.
I'm realizing I need to try pinging an external IP address to check whether it is just DNS or actual packet egress
Note - a small difference which may be a docs issue
As I'm working with both podman and apple-container, I use "host.containers.internal" (note the plural) which is what podman sets up by default. The docs for this project use singular: "host.container.internal"
I caught this quickly - but could lead to confusion
Expected behavior
egress to work
Happy to get some suggested commands when this happens to provide more info
I think the issue is with the killall -HUP mDNSResponder call that happens after creating the DNS entry restarting mDNSResponder is racy and can occasionally leave it in a broken state where DNS fails more broadly than just the scoped domain.
When it happens, scutil --dns would show whether the resolver got picked up correctly, and dig @127.0.0.1 -p 1053 google.com would confirm whether it's the embedded DNS server or mDNSResponder at fault.
Also worth noting Podman uses host.containers.internal (plural) and this project's docs use host.container.internal (singular). Would be good to document which is officially supported to avoid confusion for folks switching between tools.
/etc/pf.conf is managed by corp puppet (Google) - and may be the issue, I have an old email thread to meet with the team- but this is likely an issue only for googlers on corp gMac
I'm constantly fighting this issue, and here's some debugging and digging I've found (caveat, i've had AI support and do further research than I was able on the problem to understand it further)
Deterministic repro, and the mechanism — this is not intermittent and it is not DNS.
container system dns create <name> --localhost <ip> removes the com.apple.internet-sharing nat-anchor from the live pf ruleset. That is the anchor vmnet
NATs containers through, so every container immediately loses outbound internet.
Environment: container 1.2.2, macOS 26.3.1, Apple silicon, apiserver as a root LaunchDaemon.
pfctl -sn, either side of one container system dns create host.usable --localhost 203.0.113.1:
BEFORE (egress OK) AFTER (egress DEAD)
nat-anchor "com.apple.container" all nat-anchor "com.apple.container" all
nat-anchor "com.apple/*" all nat-anchor "com.apple/*" all
nat-anchor "com.apple.internet-sharing" all ← removed
rdr-anchor "com.apple.container" all rdr-anchor "com.apple.container" all
rdr-anchor "com.apple/*" all rdr-anchor "com.apple/*" all
rdr-anchor "com.apple.internet-sharing" all ← removed
The anchor file itself is fine — /etc/pf.anchors/com.apple.container contains exactly rdr inet from any to 203.0.113.1 -> 127.0.0.1 # host.usable. The problem is the pf reload,
not the rule.
Repro (raw-IP probe so DNS is not a variable — curl -k https://1.1.1.1/ from a container):
step
state
egress
1
rebuild the container network, 0 containers
OK (301)
2
+ 6 containers
OK
3
+ 10 containers
OK
4
container system dns create host.usable --localhost 203.0.113.1
timeout
Container count is irrelevant. The single command flips it, every time.
Two corrections to the thread:
It is not DNS. In the broken state getent hosts pypi.org resolves fine inside the
container; only packets fail. A hostname-based probe conflates the two.
container system dns delete does NOT repair it — the anchor reference is already gone
from the kernel ruleset. The only recovery I found is rebuilding the container network:
stop all containers, stop the apiserver, remove the persisted networks directory under the
app root, start again. A host reboot also works. Neither container system stop/start nor
restarting the apiserver is sufficient, which I suspect is why the "delete and recreate the
DNS entry" workaround in this thread is unreliable.
Since --localhost exists to install one rdr rule, it presumably shouldn't be rewriting and
reloading the whole ruleset — appending to the anchor and reloading only that anchor would
avoid clobbering anchors installed by other subsystems.
Activity
ptone commentedon Feb 21, 2026
I don't have all the unix network debugging tools in my container - can add some
however curl to IP address does fail
dig is there, and resolves DNS
Don't have ping, netstat :/
Ronitsabhaya75 commentedon Feb 21, 2026
I think the issue is with the
killall -HUP mDNSRespondercall that happens after creating the DNS entry restartingmDNSResponderis racy and can occasionally leave it in a broken state where DNS fails more broadly than just the scoped domain.When it happens,
scutil --dnswould show whether the resolver got picked up correctly, anddig @127.0.0.1 -p 1053 google.comwould confirm whether it's the embedded DNS server ormDNSResponderat fault.Also worth noting Podman uses
host.containers.internal (plural)and this project's docs usehost.container.internal (singular). Would be good to document which is officially supported to avoid confusion for folks switching between tools.JaewonHur commentedon Feb 23, 2026
Is it triggered only when added
--localhoston DNS creation?When the bug happens, could you share the result followings?
ptone commentedon Jul 2, 2026
Sadly this is still happening for me on 1.0
/etc/pf.conf is managed by corp puppet (Google) - and may be the issue, I have an old email thread to meet with the team- but this is likely an issue only for googlers on corp gMac
paulcdejean commentedon Aug 1, 2026
Could this issue be related to this? #2051
drewbroadley commentedon Aug 16, 2026
I'm constantly fighting this issue, and here's some debugging and digging I've found (caveat, i've had AI support and do further research than I was able on the problem to understand it further)
Deterministic repro, and the mechanism — this is not intermittent and it is not DNS.
container system dns create <name> --localhost <ip>removes thecom.apple.internet-sharingnat-anchor from the live pf ruleset. That is the anchor vmnetNATs containers through, so every container immediately loses outbound internet.
Environment: container 1.2.2, macOS 26.3.1, Apple silicon, apiserver as a root LaunchDaemon.
pfctl -sn, either side of one
container system dns create host.usable --localhost 203.0.113.1:The anchor file itself is fine —
/etc/pf.anchors/com.apple.containercontains exactlyrdr inet from any to 203.0.113.1 -> 127.0.0.1 # host.usable. The problem is the pf reload,not the rule.
Repro (raw-IP probe so DNS is not a variable —
curl -k https://1.1.1.1/from a container):container system dns create host.usable --localhost 203.0.113.1Container count is irrelevant. The single command flips it, every time.
Two corrections to the thread:
getent hosts pypi.orgresolves fine inside thecontainer; only packets fail. A hostname-based probe conflates the two.
container system dns deletedoes NOT repair it — the anchor reference is already gonefrom the kernel ruleset. The only recovery I found is rebuilding the container network:
stop all containers, stop the apiserver, remove the persisted
networksdirectory under theapp root, start again. A host reboot also works. Neither
container system stop/startnorrestarting the apiserver is sufficient, which I suspect is why the "delete and recreate the
DNS entry" workaround in this thread is unreliable.
Since
--localhostexists to install one rdr rule, it presumably shouldn't be rewriting andreloading the whole ruleset — appending to the anchor and reloading only that anchor would
avoid clobbering anchors installed by other subsystems.