Files
docker-docs/data/sbx_cli/sbx_exec.yaml
T
David Karlsson c572cdcb54 docs: cover sbx 0.50 user-facing changes (#26449)
Documents six user-facing changes in sbx 0.50: kit host mount bindings,
persistent kit volume retention, environment MCP command approvals and
ownership, HTTP query restrictions, cloud sandbox inspection, and exec
exit status in automation. Each change has its own commit. Also vendors
the matching v0.50 CLI reference verbatim and regenerates the release
notes from published GitHub releases.

Kit documentation focuses on sbx usage and links to the canonical
capability definitions. Volume retention follows the 0.50
implementation; the upstream spec's main branch describes a different
storage lifecycle.

Verified against the release implementation. Scoped Markdown and prose
lint, a full Hugo build, and checks of the added internal links pass.

Related release: https://github.com/docker/sandboxes/issues/7698

Generated by Codex
2026-10-26 17:28:15 +01:00

72 lines
2.5 KiB
YAML

name: sbx exec
synopsis: Execute a command inside a sandbox
description: |-
Execute a command in a sandbox. If the sandbox is stopped, it is started first. Or — with --cloud — the cloud sandbox
ID (sbx_*) or name from "sbx --cloud ls".
Flags match the behavior of "docker exec", except detached exec (-d/--detach)
is not supported. Some flags (-d, --user, --privileged)
are not supported with --cloud and are rejected rather than silently ignored.
--detach-keys applies only to an interactive (-i/-t) cloud exec.
Exit status is that of the command. sbx exits 125 if it could not run the command,
for example because the sandbox does not exist. A missing command exits 127,
unless a cloud backend reports it as an error rather than a status, which exits 125.
usage: sbx exec [flags] SANDBOX COMMAND [ARG...]
options:
- name: detach
shorthand: d
default_value: "false"
usage: Detached mode (not supported)
- name: detach-keys
usage: Override the key sequence for detaching a container
- name: env
shorthand: e
default_value: '[]'
usage: Set environment variables
- name: env-file
default_value: '[]'
usage: Read in a file of environment variables
- name: help
shorthand: h
default_value: "false"
usage: help for exec
- name: interactive
shorthand: i
default_value: "false"
usage: Keep STDIN open even if not attached
- name: privileged
default_value: "false"
usage: Give extended privileges to the command
- name: tty
shorthand: t
default_value: "false"
usage: Allocate a pseudo-TTY
- name: user
shorthand: u
usage: 'Username or UID (format: <name|uid>[:<group|gid>])'
- name: workdir
shorthand: w
usage: Working directory inside the container
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-
# Open a shell inside a sandbox
sbx exec -it my-sandbox bash
# Run as root
sbx exec -u root my-sandbox apt-get update
# Cloud: run a command in a cloud sandbox by ID or name
sbx --cloud exec -it sbx_abc123 bash
sbx --cloud exec -it claude/my-sandbox bash
see_also:
- sbx - Manage AI coding agent sandboxes.