--publish forwarder fails backend connect with EHOSTUNREACH while direct connections to the container IP succeed
Summary
container run --publish binds the host listener, accepts client connections, but the backend connect to the container's vmnet IP fails with No route to host (errno 65) — while direct connections to the same IP from the same host succeed at the same moment.
Environment
- container 1.2.0 (Homebrew), macOS 26.6, Apple Silicon
- Default network (nat, 192.168.64.0/24)
Repro
container run -d --name pubtest --publish 127.0.0.1:18098:80 nginx
curl http://127.0.0.1:18098/ # fails (empty reply)
curl http://192.168.64.17/ # 200 OK — direct to the VM's IP works
System logs show the forwarder accept→backend-connect failing repeatedly:
container-runtime-linux: creating forwarder for [uuid=pubtest2] [proxy=[IPv4]127.0.0.1:18098] [server=[IPv4]192.168.64.17:80] [protocol=tcp]
container-runtime-linux: backend - connect failed: connect(descriptor:addr:size:): No route to host) (errno: 65)
Simultaneous, alternating probes: curl 127.0.0.1:18098 → 000, curl 192.168.64.17 → 200, repeatedly. The host route (192.168.64.17 UHLWI bridge103) is present the whole time. UDP (--publish .../udp) fails the same way. Worked once shortly after container start on one occasion, then consistently fails.
Notes
- The backend connect is a plain SwiftNIO
ClientBootstrap.connect(to:)(Sources/SocketForwarder/ConnectHandler.swift) — no interface binding, so it's unclear why this process gets EHOSTUNREACH while others don't. - Possibly related to the intermittent "Mac cannot reach the VM IP" issue kiac reports (
no route to hostfor a control-plane VM right after boot) — both look like scoped-route (RTF_IFSCOPE on bridge103) visibility differing per process.
Update: this was the macOS Local Network privacy prompt (TCC), not a forwarder bug. After approving the prompt, --publish works correctly (verified with a probe matrix: published port and direct VM IP both 200 consistently). The only failure mode is the silent pre-approval window, where the helper's backend connect fails with EHOSTUNREACH and the user never sees a prompt unless they happen to open System Settings. Maybe worth documenting that --publish triggers a Local Network permission prompt that must be approved. Closing as user environment.