Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions content/manuals/ai/sandboxes/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,18 +456,10 @@ $ sbx port publish my-sandbox 8080:3000
$ open http://localhost:8080
```

To let the OS pick a free host port instead of choosing one yourself, specify
only the sandbox port. Then use `sbx port ls` to check which host port was
assigned:
For OS-assigned host ports and port mappings across restarts, see
[Local services](workflows/development.md#accessing-services-in-the-sandbox).

```console
$ sbx port publish my-sandbox 3000
$ sbx port ls my-sandbox
```

`sbx ls` shows active port mappings alongside each sandbox. `sbx port ls` lists
them in detail. The `CREATED` column shows the sandbox age, and the `STATUS`
column identifies sandboxes kept running in detached mode with `(detached)`.
`sbx ls` shows active port mappings alongside each sandbox:

```console
$ sbx ls
Expand All @@ -482,9 +474,7 @@ $ sbx port unpublish my-sandbox 8080:3000
```

When `sbx run` re-attaches to an existing sandbox, it ignores `--publish`. Use
`sbx port publish` to publish ports on that sandbox. For dev server and host-service
recipes, see
[Local services](workflows/development.md#local-services).
`sbx port publish` to publish ports on that sandbox.

## What persists

Expand Down
14 changes: 7 additions & 7 deletions content/manuals/ai/sandboxes/workflows/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ $ open http://localhost:8080
```

To let the OS pick a free host port instead of choosing one yourself, specify
only the sandbox port. Then use `sbx port ls` to check which host port was
assigned:
only the sandbox port. While the sandbox is running, use `sbx port ls` to
check which host port was assigned:

```console
$ sbx port publish my-sandbox 3000
$ sbx port ls my-sandbox
```

`sbx ls` shows active port mappings alongside each sandbox, and `sbx port ls`
lists them in detail:
`sbx ls` shows active port mappings alongside each sandbox:

```console
$ sbx ls
Expand Down Expand Up @@ -97,9 +96,10 @@ those require the sandboxed service to listen on IPv6 as well — bind it to
`[::]` — or a client arriving over `::1` has its connection accepted and then
reset.

Published ports survive restarts: `sbx` re-publishes them when the sandbox or
the daemon restarts. Explicit host ports are reused, while a port published with
an OS-assigned host port, such as `--publish 3000`, gets a different host port
Stopped sandboxes keep their port mappings, listed as `inactive` by
`sbx port ls`, but forward no traffic. `sbx` re-publishes them when you start
the sandbox again. Explicit host ports are reused, while a port published
with an OS-assigned host port, such as `--publish 3000`, gets a different host port
on each start. Check `sbx port ls my-sandbox` to find it. If an explicit host port
is already in use at restart, the CLI or the dashboard prompts you to choose
another. Removing the sandbox releases its ports.
Expand Down