Skip to main content
porter sandbox contains commands for listing, inspecting, executing commands in, 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. Usage:
porter sandbox create <image> [-- <command> [args...]] [flags]
Options:
FlagDescription
--nameCluster-unique sandbox name. Use lowercase letters, numbers, and hyphens; start and end with a letter or number. Use this name with exec, logs, and terminate
--commandOverride the image entrypoint. Repeat for each argv element
--argArgument passed to the command. Repeatable
-e, --envEnvironment variable in KEY=VALUE form. Repeatable
--tagTag in key=value form. Repeatable
--volumeVolume mount in mount_path=volume-ref form, where volume-ref is a volume name or ID. Repeatable. The mount path must be absolute
-o, --outputOutput format: text or json
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. 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.
porter sandbox create alpine:3.20

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:
porter sandbox list [flags]
Options:
FlagDescription
--phaseFilter by phase. Defaults to hiding terminated sandboxes. Use all to include every phase
--tagFilter by tag in key=value format. Repeat the flag to require multiple tags
-o, --outputOutput format: table, plain, or json
Phases:
PhaseDescription
queuedAccepted by the API and waiting for capacity
creatingRuntime is being prepared and the container is starting
runningSandbox is ready and can accept exec calls
succeededSandbox command completed successfully
failedSandbox command or runtime failed
terminatedSandbox was explicitly terminated
allIncludes every phase when used with --phase
Output formats:
FormatDescription
tableColorized table for terminal output
plainTab-separated rows with a header. Used by default when output is piped or redirected
jsonJSON array, recommended for scripts
Plain output includes these columns:
ColumnDescription
NAMESandbox name
IMAGEContainer image
PHASECurrent sandbox phase
CREATEDCreation timestamp
STARTEDStart timestamp, when available
EXITExit code, when available
TAGSSandbox tags
porter sandbox list

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:
porter sandbox exec <sandbox> [-it] -- <command> [args...] [flags]
Options:
FlagDescription
-c, --commandShell-style command string to run through sh -c inside the sandbox
-i, --interactiveKeep stdin open and stream it to the sandbox
-t, --ttyAllocate a TTY for an interactive shell
Do not combine --command with positional command arguments. Exit codes:
Exit codeMeaning
0Command succeeded
1Operational error or propagated sandbox command failure
2CLI usage error
3Sandbox is not in the running phase
Only running sandboxes accept exec calls.
porter sandbox exec abc123 -- ls -la /workspace

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:
porter sandbox logs <sandbox> [flags]
Options:
FlagDescription
--sinceLookback window as a Go duration, such as 30m or 1h30m. Defaults to 1h
--limitMaximum number of log lines. Defaults to 500; server cap is 5000; 0 uses the server default
--tailAlias for --limit. When greater than 0, it overrides --limit
--levelClient-side filter: info, warning, or error
--no-timestampsSuppress the leading RFC3339 timestamp on each line
Each rendered log line uses this format:
<timestamp> [<level>] <text>
porter sandbox logs abc123

porter sandbox terminate

Terminates one sandbox by name, or terminates many sandboxes with --all. Usage:
porter sandbox terminate <sandbox> [flags]
porter sandbox terminate --all [flags]
Options:
FlagDescription
--allTerminate every actionable sandbox in the current project and cluster
--dry-runPrint the sandboxes that would be terminated without terminating them
--tagScope bulk termination by tag in key=value format. Requires --all
Behavior:
CaseBehavior
--allNo interactive confirmation is shown
Already terminated sandboxesSkipped
404 during --allTreated as success because another caller may have already deleted the sandbox
porter sandbox terminate abc123

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:
porter sandbox volume list [flags]
Options:
FlagDescription
-o, --outputOutput format: table, plain, or json
Volume phases:
PhaseDescription
pendingThe volume was created and is waiting for the underlying claim to bind
readyThe volume is ready to mount into sandboxes
failedThe volume failed to provision
Output formats:
FormatDescription
tableColorized table for terminal output
plainTab-separated rows with a header. Used by default when output is piped or redirected
jsonJSON array, recommended for scripts
Plain output includes these columns:
ColumnDescription
NAMEVolume name
PHASECurrent volume phase
ATTACHEDAttached sandboxes, or - when unattached
CREATEDCreation timestamp
porter sandbox volume list

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. Usage:
porter sandbox volume create [name] [flags]
Options:
FlagDescription
-o, --outputOutput format: text or json
porter sandbox volume create my-data

porter sandbox volume get

Shows a single sandbox volume by name, including phase, creation time, and currently attached sandboxes. Usage:
porter sandbox volume get <name> [flags]
Options:
FlagDescription
-o, --outputOutput format: text or json
porter sandbox volume get my-data

porter sandbox volume delete

Deletes a sandbox volume by name. Usage:
porter sandbox volume delete <name>
The server rejects deletion while the volume is attached to any sandbox. Terminate or recreate the attached sandboxes first.
porter sandbox volume delete my-data

Common Workflows

WorkflowCommand
Create a named sandboxporter sandbox create alpine:3.20 --name web -- sleep 3600
Create and mount a volumeporter sandbox volume create my-data && porter sandbox create ubuntu:24.04 --volume /workspace=my-data -- bash
List running sandboxesporter sandbox list --phase running
Get running sandbox names for a scriptporter sandbox list -o json | jq -r '.[] | select(.phase == "running") | .name'
Run a smoke commandporter sandbox exec <sandbox-name> -- python -c 'print("ok")'
Fetch recent errorsporter sandbox logs <sandbox-name> --since 30m --level error
Preview tagged cleanupporter sandbox terminate --all --tag run=<run-id> --dry-run
Clean up tagged sandboxesporter sandbox terminate --all --tag run=<run-id>