Files
docker-docs/data/sbx_cli/sbx_exec.yaml
T
David Karlsson 1773367159 Sync sbx CLI reference from release/v0.51 (#26514)
Vendor the checked-in CLI YAML from Docker Sandboxes release/v0.51 at
7d55286de0c7. This updates command help, adds `sbx policy check http`,
and replaces seven agent-specific create pages with redirects to `sbx
create`.

Validation: full site build with Hugo 0.169.0; upstream byte-for-byte
comparison; all 115 command pages, reference links, and seven redirects
checked; template formatting and whitespace checks passed.
2026-11-04 10:10:52 +01:00

76 lines
2.7 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
- name: no-input
default_value: "false"
usage: |
Never prompt; commands that need an answer fail with the command to run instead
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.