Skip to content

docs: sandbox published ports survive restarts#25386

Open
dvdksn wants to merge 2 commits into
docker:mainfrom
dvdksn:docs-sbx-port-persist-restarts
Open

docs: sandbox published ports survive restarts#25386
dvdksn wants to merge 2 commits into
docker:mainfrom
dvdksn:docs-sbx-port-persist-restarts

Conversation

@dvdksn

@dvdksn dvdksn commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

Document persistent port publishing.

The "Accessing services in the sandbox" section of the sandboxes usage guide previously stated that published ports are not persistent and must be re-published after a restart. That's no longer true. This PR updates the port-publishing notes to describe the new behavior:

  • Published ports are re-published automatically when the sandbox or the daemon restarts.
  • Explicit host ports are reused; a port published with an OS-assigned (ephemeral) host port gets a fresh host port on each start.
  • If an explicit host port is already in use at restart, the CLI or the dashboard prompts you to choose a different host port or cancel.
  • --unpublish 3000 (sandbox-port-only, no host port) is now accepted and removes every host port mapped to that sandbox port — useful for ephemeral ports whose host number you don't know. The previous note said this form was rejected.

Related issues

  • docker/sandboxes#3614

🤖 Generated with Claude Code

Published ports are now persisted and re-published when a sandbox or the
daemon restarts (docker/sandboxes#3614). Explicit host ports are reused;
OS-assigned host ports get a fresh port on each start. Update the port
publishing notes in the sandboxes usage guide to reflect persistence and
the new wildcard unpublish-by-sandbox-port behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 1e66664
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6a3395a8cab3c80008713a85
😎 Deploy Preview https://deploy-preview-25386--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

The changes correctly update the port-publishing behavior documentation to reflect that published ports now persist across sandbox and daemon restarts. The updated content is accurate, clear, and consistent with the existing document style. No high- or medium-severity issues found.

Replace the bulleted 'a few things to keep in mind' list with concise
prose paragraphs and drop the bold-term format.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@craig-osterhout craig-osterhout requested review from a team and kiview June 26, 2026 15:07
@craig-osterhout craig-osterhout marked this pull request as ready for review June 26, 2026 15:07

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟡 NEEDS ATTENTION

The PR cleanly documents new sandbox port-persistence behavior. Two minor points worth verifying before merge — both relate to the accuracy of newly-added behavioral descriptions.


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 new host port on each

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] --publish 3000 example may confuse Docker users about OS-assigned vs. explicit host ports

The new text uses --publish 3000 as an example of a port published with an OS-assigned host port. However, Docker users familiar with docker run -p may interpret --publish 3000 as an explicit mapping (sandbox port 3000 to host port 3000), not as a request for an ephemeral host port. In Docker's standard CLI, an OS-assigned host port is typically expressed as -p :3000 or -p 0:3000 (with a colon).

If sbx publish's bare-port syntax genuinely differs from docker run -p, a brief clarification here would prevent confusion — for example, noting that --publish 3000 means "sandbox port 3000 on an ephemeral host port" or using --publish :3000 if that syntax is also supported.

the daemon restarts. Explicit host ports are reused, while a port published with
an OS-assigned host port (such as `--publish 3000`) gets a new host port on each
start, so check `sbx ports 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Specific interactive behavior claim — "prompts you to choose another" — may need verification

The sentence claims that when an explicit host port is already in use at restart, "the CLI or the dashboard prompts you to choose another." This is a specific UX assertion: an interactive prompt appears. If the actual behavior is a non-interactive error exit, a warning with automatic fallback, or something else, users will be misled about how to handle the conflict.

Worth double-checking that the CLI/dashboard UX matches this description before merging, especially since the precise interaction mode (prompt vs. error) affects how users should respond.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants