Scenario

A published port that answered on one loopback

L1ScreenIncident15 minScreenDebugging

RolesAgent Systems EngineeringCustomer AI Deployment

Engine
sbx v0.47.0
Model
none; shell commands inside the sandbox
Hardware
one Mac with the microVM runtime

Situation

A developer serves a static site from inside a sandbox on port 8080 and publishes it to the host with sbx ports m101-demo --publish 18081:8080. A browser on the host opens the page. A test harness on the same host reports that it could not connect, and its log shows that it tried ::1. The developer suspects that the server inside the sandbox listens on one interface only and starts editing its configuration.

You have the publish command and its listing, the same URL fetched on both loopback addresses, the listing in sbx ls, a second publish with a protocol named, and the unpublish calls.

Questions

  1. Which side refused the connection, the server in the sandbox or the host binding? What in the listing says so?
  2. What does a publish without a protocol bind, and since which release?
  3. How do you publish so that both loopbacks answer?
  4. The -p flag on sbx run did not help on a re-attach. Why?
  5. How do you remove a binding, and how do you check that it is gone?

Commit to a cause after each listing. Write it down before you read the next one.

Evidence

1/5

a port published without a protocol, and the listing

Read the protocol column.

evidence/publish-and-list.txt
$ sbx ports m101-demo --publish 18081:8080
Published 127.0.0.1:18081 -> 8080/tcp4
[exit 0]

$ sbx ports m101-demo
HOST IP     HOST PORT   SANDBOX PORT   PROTOCOL
127.0.0.1   18081       8080           tcp4
[exit 0]

Source: manuals/docker-sandboxes-101/capture/out/05-ports.txt

2/5

the same URL on the two loopback addresses

Read the status code and the exit code of each request.

evidence/two-loopbacks.txt
$ curl -sS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:18081/README.md
200
[exit 0]

$ curl -sS -o /dev/null -w '%{http_code}\n' 'http://[::1]:18081/README.md'
curl: (7) Failed to connect to ::1 port 18081 after <n> ms: Couldn't connect to server
000
[exit 7]

Source: manuals/docker-sandboxes-101/capture/out/05-ports-curl.txt

3/5

the binding in the PORTS column of sbx ls

The column names the host address and the protocol.

evidence/the-ports-column.txt
$ sbx ls
SANDBOX     AGENT   STATUS    PORTS                        WORKSPACE
m101-demo   shell   running   127.0.0.1:18081->8080/tcp4   $CAPTURE/fixtures/repo
[exit 0]

Source: manuals/docker-sandboxes-101/capture/out/05-ports-ls.txt

4/5

a publish with the protocol named, and the JSON listing

Read the host_ip of each record.

evidence/a-dual-stack-publish.txt
$ sbx ports m101-demo --publish 8080/tcp
Published 127.0.0.1:<port> -> 8080/tcp
Published [::1]:<port> -> 8080/tcp
[exit 0]

$ sbx ports m101-demo --json
[
  {
    "host_ip": "127.0.0.1",
    "host_port": 18081,
    "sandbox_port": 8080,
    "protocol": "tcp4"
  },
  {
    "host_ip": "127.0.0.1",
    "host_port": "<port>",
    "sandbox_port": 8080,
    "protocol": "tcp"
  },
  {
    "host_ip": "::1",
    "host_port": "<port>",
    "sandbox_port": 8080,
    "protocol": "tcp"
  }
]
[exit 0]

Source: manuals/docker-sandboxes-101/capture/out/05-ports-tcp.txt

5/5

two unpublish calls and the empty listing

The spec of each unpublish matches the spec that published it.

evidence/unpublish.txt
$ sbx ports m101-demo --unpublish 18081:8080
Unpublish requested for port 18081 -> 8080
[exit 0]

$ sbx ports m101-demo --unpublish <port>:8080/tcp
Unpublish requested for port <port> -> 8080/tcp
[exit 0]

$ sbx ports m101-demo --json
[]
[exit 0]

Source: manuals/docker-sandboxes-101/capture/out/05-ports-unpublish.txt

The answer

Show the walkthrough
  1. Read the protocol column. The publish answered Published 127.0.0.1:18081 -> 8080/tcp4, and the listing shows one row with the host address 127.0.0.1 and the protocol tcp4. The host binding is IPv4 only. The server inside was never asked.
  2. Confirm with the two fetches. 127.0.0.1:18081 returns 200. [::1]:18081 fails to connect and curl exits 7. The failing side is the host loopback where nothing listens.
  3. Name the rule. Without a protocol, publishing uses tcp4, so the host side is 127.0.0.1 alone. The manual dates the change to v0.42.0: a published port no longer listens on ::1 unless you name the protocol. The 2025 plugin bound both loopbacks, which conflict C39 records. sbx ls shows the same binding in its PORTS column.
  4. Publish for both families. --publish 8080/tcp binds 127.0.0.1 and [::1] on ephemeral host ports, and sbx ports --json lists three records: the first tcp4 binding and two tcp ones, one per address. Name a host port in the spec when the harness needs a fixed one.
  5. Remove what you no longer need. --unpublish 18081:8080 and --unpublish <port>:8080/tcp each remove their mapping, and the JSON listing ends empty. -p on sbx run applies at creation only, so later changes go through sbx ports.
Show the resolution

The server was fine. The host binding was tcp4, so only 127.0.0.1 listened, and the harness's connection to ::1 found no listener. Publishing 8080/tcp with a fixed host port gives both loopbacks a binding, and the harness connects. The edits inside the sandbox are reverted.

Show the wrong turns
  • “Bind the server inside the sandbox to all interfaces.”

    The guest side already answered through the IPv4 mapping. The missing listener was on the host loopback.

  • “Pass -p 18081:8080/tcp on the next sbx run.”

    On an existing sandbox the flag is ignored. Use sbx ports.

  • “Turn off IPv6 in the test harness.”

    It works, and it hides a binding rule that the next harness will hit again.

Show the general rule

When one client reaches a service and another does not, compare the addresses each one used before you touch the service. A port mapping has its own address family, and a listing that prints it saves an hour of edits in the wrong place.

Taught in

The ports page gives the tcp4 rule and the protocol table, and the conflicts register records the change as C39.