Skip to content

Apple Container DNS Setup

When using Apple Container as your container runtime, Scion agents need to reach the Hub server. This requires a DNS rule that maps host.containers.internal to the loopback address.

Apple Container’s DNS rules persist across sessions but the underlying PF (packet filter) rules do not survive macOS reboots. You need to re-run this command after each reboot:

Terminal window
sudo container system dns create host.containers.internal --localhost 203.0.113.1

The DNS setup modifies macOS PF (packet filter) rules, which require root access. This is an Apple Container limitation — there is no rootless alternative for PF rules.

Because the command requires root, it must be installed as a system-level LaunchDaemon (not a user LaunchAgent). User-level agents run without a terminal, so sudo cannot prompt for a password.

Create /Library/LaunchDaemons/org.scion.apple-container-dns.plist as root:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.scion.apple-container-dns</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/container</string>
<string>system</string>
<string>dns</string>
<string>create</string>
<string>host.containers.internal</string>
<string>--localhost</string>
<string>203.0.113.1</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

Load the daemon (runs immediately and on every subsequent boot):

Terminal window
sudo launchctl bootstrap system /Library/LaunchDaemons/org.scion.apple-container-dns.plist

To check if the DNS rule is configured:

Terminal window
container system dns list

You should see host.containers.internal in the output.