docs: sandbox published ports survive restarts#25386
Conversation
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>
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
docker-agent
left a comment
There was a problem hiding this comment.
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>
docker-agent
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
[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 |
There was a problem hiding this comment.
[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.
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:
--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
🤖 Generated with Claude Code