Skip to main content
porter sandbox contains commands for listing, inspecting, executing commands in, monitoring CPU and memory usage of, and terminating sandboxes in the currently selected Porter project and cluster.
Sandboxes are in a private beta. Please reach out to us at support@porter.run or over Slack if you are interested in joining.

Prerequisites

If the CLI cannot find a selected project or cluster, it asks you to run porter config or pass --project and --cluster.

porter sandbox create

Creates a sandbox from a container image in the current project and cluster. The image accepts a tag (alpine:3.20) or a digest (repo@sha256:<digest>). Usage:
Options: Use the positional form after -- for common one-shot commands. Use --command and --arg when scripting individual argv elements. Volume values can be volume names or volume IDs. The CLI resolves names first, then falls back to treating the value as an ID. --env-group injects the variables of a named environment group on the cluster. Values are resolved to the group’s latest version at create time and do not update afterwards. On a key conflict, a later --env-group wins over an earlier one, and an explicit --env wins over any group value. Creation fails if a named group does not exist on the cluster or has not synced yet. --ttl bounds the sandbox’s lifetime regardless of its main process: once the duration elapses, counted from creation, Porter terminates the sandbox the same way an explicit terminate does. See sandbox lifetime. --cpu and --memory size an individual sandbox instead of using the cluster’s default sandbox size. Pass one or both; the flag you omit keeps the default. CPU is in cores, either a whole number (2) or an m suffix for a fraction (500m is half a core), and memory takes a Gi or Mi suffix (4Gi, 512Mi). See custom sandbox sizes. Sandbox names currently cannot be reused, even after the sandbox is terminated. Omit --name only for one-off sandboxes where you do not need stable lookup later. The sandbox runs as long as its main process. When the process exits, the sandbox moves to succeeded or failed and stops accepting exec calls, so pass a long-running command if you plan to exec into the sandbox. See sandbox lifetime.

porter sandbox list

Lists sandboxes in the current project and cluster. The command auto-paginates through the API and sorts results most-recent-first. Usage:
Options: Phases: Output includes these columns:

porter sandbox exec

Runs a command in a running sandbox, identified by name. Non-interactive exec prints stdout and stderr; interactive exec opens a shell session. Usage:
Options: Do not combine --command with positional command arguments. Exit codes: Only running sandboxes accept exec calls.

porter sandbox logs

Fetches and prints a batch of log lines for a sandbox. By default, the CLI requests logs from the last hour with a limit of 500 lines. Usage:
Options: Each rendered log line uses this format:

porter sandbox metrics

Use this command to monitor a sandbox’s resource usage: how much CPU and memory it is consuming and how close it is to its limits. It prints p50 and p90 CPU and memory usage over a lookback window for a running sandbox, alongside the sandbox’s CPU and memory limits and each percentile’s utilization as a percentage of that limit. Only running sandboxes report metrics. Usage:
Options: CPU is reported in cores and memory in bytes. Utilization is each percentile divided by the sandbox’s limit, as a percentage; it can exceed 100% because the limit is a throttling and OOM threshold, not a hard cap on the reported sample. Memory values include page cache and slightly overestimate resident memory. The summary has one row per metric (cpu_cores, mem_bytes) with these columns: --json prints the same values at full precision on one line, plus a has_data boolean that is false when no samples were collected in the window.
Output looks like this:

porter sandbox terminate

Terminates one sandbox by name, or terminates many sandboxes with --all. Usage:
Options: Behavior:

porter sandbox volume

Manages persistent volumes that sandboxes can mount at launch. Create a volume first, then reference it from porter sandbox create with --volume <mount_path>=<volume-ref>, where volume-ref is a volume name or ID.

porter sandbox volume list

Lists sandbox volumes in the current project and cluster, sorted most-recent-first. Usage:
Options: Volume phases: Output includes these columns:

porter sandbox volume create

Creates a persistent volume on the current cluster. The volume name may contain lowercase letters, numbers, and hyphens, and must start and end with a letter or number. Omit the name only for one-off volumes where you do not need stable lookup later. Volumes start in the pending phase. Sandboxes that mount them wait for the underlying claim to bind, so porter sandbox create does not need a separate wait step. Volume names must be unique within a cluster for the lifetime of the volume. After a volume is deleted, its name can be used again. With --bucket, the volume is an object volume exposing an S3 bucket registered with porter storage bucket register. Use --prefix to scope it to keys under a prefix and --access to restrict how sandboxes can use it. Usage:
Options:

porter sandbox volume get

Shows a single sandbox volume by name, including phase, creation time, and currently attached sandboxes. Usage:
Options:

porter sandbox volume files

Lists the files and directories under a path inside a volume. Omit the path to list from the volume root. The server walks the tree up to an entry budget; directories it could not fully read are marked truncated. List them directly to see more. Usage:
Options:

porter sandbox volume read

Streams a file’s raw bytes from a volume to stdout. Redirect stdout to save the file locally, or use --range to read part of a large file. Usage:
Options: Reading a path that does not exist fails with a not-found error.

porter sandbox volume write

Uploads a file into a volume at a path relative to the volume root. Parent directories are created as needed, and an existing file at the path is replaced. Content comes from stdin unless --file names a local file. The write is staged to a temporary file and renamed into place, so a failed or interrupted upload leaves the previous contents alone rather than a truncated file. You can write to a volume whether or not a sandbox has it mounted. Usage:
Options: A single write is capped at 1 GiB, and a request from outside the cluster must finish within 30 seconds; write very large files from inside a sandbox that mounts the volume.

porter sandbox volume move

Moves a file or directory to a new path inside one volume. The destination is the entry’s full new path, not a directory to drop it into, so a move renames and relocates in one call. A directory moves with everything under it. Usage:
The destination’s parent directory must already exist, and nothing is replaced. The server refuses a move onto an occupied path, and the volume root cannot be moved or overwritten.

porter sandbox volume delete

Deletes a sandbox volume by name. Usage:
The server rejects deletion while the volume is attached to any sandbox. Terminate or recreate the attached sandboxes first.

Common Workflows