mirror of
https://github.com/docker/docs.git
synced 2026-11-04 10:01:00 +00:00
sbx: document sbx run --rm
Explain that --rm removes a local or cloud sandbox when the agent session exits, when a reattached sandbox is kept, and why --rm can't be combined with --detached or --detach-keys. Source: docker/sandboxes#6601 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
1 parent
4d3cbcd0f7
commit
777a8a3a41
2 files changed
+31
No files matched your search
@@ -241,6 +241,20 @@ $ sbx --cloud rm cloud-project
|
||||
Removal asks for confirmation, deletes the cloud sandbox, and can't be undone.
|
||||
Use `--force` to skip the prompt in scripts.
|
||||
|
||||
### Remove a sandbox when the agent exits
|
||||
|
||||
Pass `--rm` to an interactive `run` to remove the sandbox when the agent
|
||||
session ends:
|
||||
|
||||
```console
|
||||
$ sbx --cloud run --rm claude
|
||||
```
|
||||
|
||||
The detach gesture is turned off for that session, and you can't combine
|
||||
`--rm` with `--detached`. If the session ends without completing, for example
|
||||
because the connection drops, the sandbox is kept and the CLI prints the
|
||||
command to remove it.
|
||||
|
||||
## Use persistent volumes
|
||||
|
||||
Cloud volumes are experimental and preserve data independently of a sandbox.
|
||||
|
||||
@@ -67,6 +67,23 @@ such as `168h`, an RFC 3339 timestamp, or a Unix timestamp. The older
|
||||
|
||||
Run `sbx prune` without flags to confirm and remove all stopped sandboxes.
|
||||
|
||||
### Remove a sandbox when the agent exits
|
||||
|
||||
Pass `--rm` to `sbx run` for a throwaway session. The sandbox is removed when
|
||||
the agent exits, without a confirmation prompt:
|
||||
|
||||
```console
|
||||
$ sbx run --rm claude
|
||||
```
|
||||
|
||||
The sandbox is removed however the agent exits, and `sbx run` exits with the
|
||||
agent's exit status. If `sbx run` created the sandbox and the agent fails
|
||||
to start, the sandbox is also removed. If you reattach to an existing sandbox
|
||||
with `--rm`, that sandbox is removed only after its agent session finishes.
|
||||
|
||||
`--rm` needs an attached agent session to know when to remove the sandbox, so
|
||||
you can't combine it with `--detached` or `--detach-keys`.
|
||||
|
||||
## Choose a workspace
|
||||
|
||||
`sbx run` mounts the current directory when you don't pass a workspace path.
|
||||
|
||||
Reference in new issue
Block a user