by
clemens
(08.09.2026)
Connection to LmStudio not possible from inside apple container after system reboot
tl;dr
After a reboot of MacOS, one needs to recreate the apple container dns resolver because it does not persist across restarts:
sudo container system dns rm host.container.internal
sudo container system dns create host.container.internal --localhost 203.0.113.113
container system stop
container system start
The reason is that the mapping of --localhost 203.0.113.113 is not persisted across restarts. The mapping itself is required
because each container runs in a custom virtual machine, so 127.0.0.1 redirects to the VM instead of the host.
What –localhost changes under the hood:
- Loopback Rewriting: It tells the DNS system daemon that the IP 203.0.113.113 should act as an alias to bridge container network requests back to your physical Mac host.
- Traffic Routing: When a container resolves host.container.internal, the container engine routes those requests across the virtual network switch directly to the macOS host system instead of trapping them inside the container’s isolated loopback loop.
- IP Choice (203.0.113.113): This is a designated TEST-NET-3 IP address (RFC 5737) that won’t conflict with public internet addresses or local subnet LAN IPs.