mirror of
https://github.com/docker/docs.git
synced 2026-11-04 10:01:00 +00:00
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.
100 lines
3.9 KiB
YAML
100 lines
3.9 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
|
|
is started first if stopped. If it does not exist, an interactive terminal prompts
|
|
to create it and approve the environment plan before running COMMAND. Without an
|
|
interactive terminal, or with --no-input, create it first with "sbx env create".
|
|
|
|
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
|
|
- name: no-input
|
|
default_value: "false"
|
|
usage: |
|
|
Never prompt; commands that need an answer fail with the command to run instead
|
|
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
|