Files
docker-docs/data/sbx_cli/sbx_ports.yaml
T
David Karlsson c64e3927ef docs: update Sandboxes for the v0.48.0 CLI refactor (#26314)
## Summary

Update the Sandbox documentation for the v0.48.0 CLI refactor: renamed
flags, settings commands, terminal output, structured output, and
non-interactive confirmations. Add a migration reference for scripts and
CI workflows, with a [**Copy as prompt**
button](https://deploy-preview-26314--docsdocker.netlify.app/ai/sandboxes/workflows/automation/#update-scripts-for-v0480)
that copies agent instructions and the section Markdown.

This PR targets `main` independently of the other PRs in the sbx/v0.48.0
milestone. It keeps the generated reference import separate from
documentation edits:

- Vendor the 120 generated CLI YAML files
- Update command examples and guidance. Historical release notes retain
their original command spellings.

The other milestone PRs cover separate release features; this PR covers
the CLI migration.

@netlify /ai/sandboxes/workflows/automation/

Generated by Codex
2026-10-13 17:18:50 +02:00

84 lines
3.2 KiB
YAML

name: sbx ports
synopsis: Manage sandbox port publishing
description: |-
Manage sandbox port publishing.
List, publish, or unpublish sandbox ports. Publishing a local port starts a
stopped sandbox before creating the host binding. Without --publish or
--unpublish flags, lists all published ports.
Port spec format: [[HOST_IP:]HOST_PORT:]SANDBOX_PORT[/PROTOCOL]
If HOST_PORT is omitted, an ephemeral port is allocated automatically.
If HOST_IP is omitted, the port is bound on loopback, expanded based on
PROTOCOL and the sandbox's address families: tcp/udp binds both 127.0.0.1
and ::1 (or only 127.0.0.1 if the sandbox is IPv4-only); tcp4/udp4 binds
only 127.0.0.1; tcp6/udp6 binds only ::1.
Supported protocols: tcp, tcp4, tcp6, udp, udp4, udp6.
When publishing without a PROTOCOL, tcp4 is used — so a sandbox service
listening only on IPv4 is reachable without a host client having to avoid
::1 — or tcp6 when HOST_IP is an IPv6 address. Publish tcp explicitly to
bind both families.
When unpublishing without a PROTOCOL, the mapping is removed whether it was
published with that same default or as dual-stack tcp. Name the protocol to
remove a tcp6 or udp mapping; anything left behind is reported.
With --cloud:
Manage the exposed ports of a cloud sandbox.
List, publish, or unpublish ports on a cloud sandbox given by ID (sbx_*) or
name. Without --publish or --unpublish flags, lists the exposed ports.
A port is the sandbox port number alone or with a /tcp suffix; UDP and host
bindings are refused. The cloud control plane assigns a publicly reachable URL
for each exposed port.
usage: sbx ports SANDBOX [flags]
options:
- name: format
usage: 'Output format: table, json or yaml'
- name: help
shorthand: h
default_value: "false"
usage: help for ports
- name: json
default_value: "false"
usage: Output in JSON format
- name: publish
default_value: '[]'
usage: |
Publish a port (can be repeated): [[HOST_IP:]HOST_PORT:]SANDBOX_PORT[/PROTOCOL] (local) or SANDBOX_PORT[/tcp] (cloud)
- name: unpublish
default_value: '[]'
usage: |
Unpublish a port (can be repeated): [HOST_IP:]HOST_PORT:SANDBOX_PORT[/PROTOCOL] (local) or SANDBOX_PORT[/tcp] (cloud)
inherited_options:
- name: cloud
default_value: "false"
usage: |
Dispatch to Docker Cloud Sandboxes API instead of local sandboxd (supported by a growing set of verbs — run 'sbx --cloud --help' for the current list)
- name: debug
shorthand: D
default_value: "false"
usage: Enable debug logging
example: |4-
# List published ports
sbx ports my-sandbox
# Publish sandbox port 8080 to an ephemeral host port
sbx ports my-sandbox --publish 8080
# Publish with a specific host port
sbx ports my-sandbox --publish 3000:8080
# Unpublish a port
sbx ports my-sandbox --unpublish 3000:8080
# Expose port 8080 on a cloud sandbox
sbx --cloud ports sbx_abc123 --publish 8080
# Remove an exposed port from a cloud sandbox
sbx --cloud ports sbx_abc123 --unpublish 8080
see_also:
- sbx - Manage AI coding agent sandboxes.