Files
docker-docs/data/sbx_cli/sbx_env_exec.yaml
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

95 lines
3.6 KiB
YAML

name: sbx env exec
synopsis: Execute a command inside a sandbox environment
experimental: true
description: |-
Run COMMAND in the sandbox declared in sbxenv.yaml. The sandbox
must already exist (see "sbx env create" and "sbx env run"); a stopped sandbox is
started first.
Arguments before `--` are environment-file paths, following the same rules as
the other "sbx env" subcommands: each PATH may be a directory (the file is
<PATH>/sbxenv.yaml) or the path to the environment file itself, and passing
more than one deep-merges them in order. Without a `--` every positional
argument forms the command and the environment file is read from the current
directory.
A directory PATH selects sbxenv.yaml; a file PATH selects that file.
With no PATH, ~/.sbxenv.yaml supplies shared defaults when present.
Explicit PATHs skip those defaults. Later files override earlier values;
lists such as ports and mcp.servers are concatenated.
Flags match the behavior of "sbx 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 env exec [flags] [PATH...] -- 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-arg
default_value: '[]'
experimental: true
usage: |
Value for an argument the environment file declares, as name=value (can be repeated)
- name: env-args-file
default_value: '[]'
experimental: true
usage: |
File of name=value environment arguments, one per line (can be repeated); --env-arg overrides
- 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: name
usage: |
Name for the sandbox, overriding 'name:' in sbxenv.yaml and the derived <agent>-<directory> (every 'sbx env' command addressing this environment needs the same value)
- 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-
# Run a command in the environment declared in the current directory
sbx env exec go test ./...
# Open a shell
sbx env exec -it -- bash
# Run against explicitly merged environment files
sbx env exec sbxenv.yaml override.yaml -- npm test
see_also:
- sbx env - (Experimental) Manage sandboxes declaratively from an sbxenv.yaml file