Skip to content

[Bug]: container on MacOS 27 beta does not forward localhost traffic to published container port #2029

Closed

Description

@FlorianSW

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

(Expected container system is installed and running)

Expected: a response should be shown
Actual: curl: (56) Recv failure: Connection reset by peer

Problem description

I'm not entirely sure if it is needed to open this bug report here, as this seems to be an issue with the MacOS 27 (beta). However, for visibility I wanted to still open this issue :) I also submitted this as feedback to Apple with ID FB24027799

When running a container with apple/container on the latest official release (1.1.0 with the signed installer), trying to expose/publish a port to forward traffic from the host to the container, forwarding network traffic to the container does not work.

Steps to reproduce:
(Expected container system is installed and running)

  • start a test container: container run --rm -d --name port-test -p 127.0.0.1:8080:80 nginx:alpine
  • try to connect to the published port: curl http://127.0.0.1:8080

Expected: a response should be shown
Actual: curl: (56) Recv failure: Connection reset by peer

Directly connecting to the container IP address (192.168.64.x) does work flawlessly. Showing the logs of the container system (container system logs) reveals:

2026-07-28 10:54:22.166352+0200 0x33afb    Error       0x0                  22119  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] backend - connect failed: connect(descriptor:addr:size:): No route to host) (errno: 65) [uuid=port-test] [server=[IPv4]127.0.0.1/127.0.0.1:53710] [proxy=[IPv4]127.0.0.1/127.0.0.1:8080]

In MacOS 26, when trying to connect, TCC asks for local network access for “container-runtime-linux”. This permission prompt neither shows in MacOS 27 beta, nor does container-runtime-linux appear in the list of apps in Settings -> Privacy & Security -> Local Network.

Environment

- OS:macOS 27 beta (26A5388g)
- Xcode: -
- Container: container CLI version 1.1.0 (build: release, commit: 5973b9c)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added theissue type on Jul 28, 2026
  2. terryzwt commented on Jul 31, 2026

    @terryzwt

    same here.

  3. jcbl1 commented on Aug 3, 2026

    @jcbl1

    same on container 1.2.0 and macos 27 (26A5388g).

    Workarounds:

    option 1: use 192.168.64.x instead
    option 2: according to official technote,

    sudo defaults write com.apple.network.local-network AllowedEthernetLocalNetworkAddresses -array "192.168.64.0/24"
    sudo defaults write com.apple.network.local-network AllowedWiFiLocalNetworkAddresses -array "192.168.64.0/24"

    a reboot may be needed.

  4. JamesATUK commented on Aug 6, 2026

    @JamesATUK

    I’m running macOS 26.6 and container 1.2 and also getting this error, even with the correct TCC local network permission.

  5. rfay commented on Aug 6, 2026

    @rfay

    I can confirm this on macOS 27 beta (26A5388g — same build as the original report), container 1.2.0, signed installer (installRoot: /usr/local/), and can add a couple of data points that narrow this down further.

    Reversible on/off repro via the TCC grant itself. Toggling the container-runtime-linux entry in System Settings > Privacy & Security > Local Network off and on directly reproduces and clears the symptom in this issue (Recv failure: Connection reset by peer on a published port, direct connection to the container's own IP unaffected). Confirmed both directions, live:

    $ container run --rm -d --name port-test -p 127.0.0.1:18080:80 nginx:alpine
    $ curl http://127.0.0.1:18080/
    # with permission ON:  200 OK
    # with permission OFF: curl: (56) Recv failure: Connection reset by peer

    @jcbl1's subnet-preauth workaround (option 2) works, but needs a reboot. I tested this in isolation — TCC permission for container-runtime-linux left OFF the whole time, so the workaround alone is what's under test:

    sudo defaults write com.apple.network.local-network AllowedEthernetLocalNetworkAddresses -array "192.168.64.0/24"
    sudo defaults write com.apple.network.local-network AllowedWiFiLocalNetworkAddresses -array "192.168.64.0/24"

    Immediately after applying it, forwarding still reset — no effect without a reboot. After rebooting (defaults persisted, TCC grant confirmed still OFF via System Settings), the exact same repro returned a clean 200 OK. So this seems to work as a system-level bypass of the per-app TCC grant, it just isn't live until reboot — worth calling out explicitly since it's easy to conclude the workaround "doesn't work" if tested without one, the same trap I fell into initially.

    This doesn't seem to explain: @JamesATUK's report that it fails "even with the correct TCC local network permission" on macOS 26.6 stable. My testing only shows the inverse case (workaround succeeds despite TCC being off), not a case where TCC is on/correct and it still breaks. A couple of things worth checking on his end to narrow that down further:

    • Does he have more than one container install (e.g. both the signed installer and a Homebrew build)? Both declare the same bundle identifier (com.apple.container.container-runtime-linux) despite being signed completely differently (TeamIdentifier set vs. ad-hoc, hardened runtime vs. not) — it's plausible the entry shown as "granted" in Settings doesn't correspond to the binary actually invoked.
    • What subnet is his container guest actually on (container ls -a shows the IP) — if it's not 192.168.64.0/24, the same preauth approach would need the matching subnet.

    Happy to help build out a more targeted repro for the "TCC says granted, still fails" case if that's useful for narrowing root cause — this is blocking Docker-API compatibility layers (e.g. socktainer) that downstream tools like DDEV depend on for published-port workflows, so we've got a fair amount of test surface to work with.

  6. JamesATUK commented on Aug 7, 2026

    @JamesATUK

    To add more info to this:

    Only one container present.
    Standard subnet 192.168.64.0/24

    I’m very new to this so apologies if this is expected or I missed something but port mapping seems not to function at all. If I try the simple Nginx example shown above, I can connect to the 192.168.64.0/24 address but connecting to either loopback or my actual ip address or hostname fails every time. That is, no services are available to any other device on the lan from a container running on my Mac.

  7. pjezek commented on Aug 18, 2026

    @pjezek

    Thanks for this issue and mentioned workaround mentioned in #2029 (comment).

    I could reproduce this issue on OSX 26.6.2 with container CLI version 1.2.2 (build: release, commit: unspeci).
    The workaround works after restart:

    container run -d -p 127.0.0.1:8080:8000 --rm --name my-web-server python:alpine python3 -m http.server 8000

    curl http://127.0.0.1:8080
    # with permission ON:  200 OK
    # with permission OFF: curl: (56) Recv failure: Connection reset by peer
    
    curl http://192.168.64.2:8000
    # with permission ON:  200 OK
    # with permission OFF: curl: (56) Recv failure: Connection reset by peer
    

    Have a nice day.

    Update note: I am affected from: #1307 once I start VPN. Without VPN It works as expected. With VPN it seems that I can use IPv6.

  8. FlorianSW commented on Aug 28, 2026

    @FlorianSW
    Author

    Apple answered to my feedback and indicated that there is a fix shipped with MacOS 27 Beta 7:

    macOS 27 beta 7 (Build: 26A5421a)
    https://developer.apple.com/download/
    Posted Date: August 24, 2026

    I've installed that beta already and container-runtime-linux is now correctly listed in the Privacy & Security settings, and I can turn that on and off. The traffic is no also correctly forwarded to the container when doing the steps from the initial issue.

    Can one of you verify my results so that I can close this issue? :)

  9. rfay commented on Aug 28, 2026

    @rfay

    Yes, fixed! I'm running 26A5421a from the public beta and now got past this problem.

  10. 2 remaining items

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions