Skip to content

--publish forwarder fails backend connect with EHOSTUNREACH while direct connections to the container IP succeed #2067

Closed

Description

@ronandi

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 host for a control-plane VM right after boot) — both look like scoped-route (RTF_IFSCOPE on bridge103) visibility differing per process.

Activity

  1. ronandi commented on Aug 4, 2026

    @ronandi
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions