Skip to main content

oc exec <id> [flags] -- <command...>

By default, creates an exec session and prints the session ID with attach instructions. Use --wait to run synchronously. HTTP API →
--wait
boolean
default:"false"
Wait for completion, stream output, mirror exit code
--cwd
string
Working directory
--timeout
int
default:"0"
Timeout in seconds (0 = none)
--env
string
Environment variable KEY=VALUE (repeatable)
# Synchronous — streams output, exits with process exit code
oc exec sb-abc --wait -- npm run build

# Asynchronous — creates session, prints session ID
oc exec sb-abc -- node server.js
# → Session es-xyz created. Attach with: oc exec attach sb-abc es-xyz

oc exec list <id>

List active exec sessions for a sandbox. HTTP API → Output: session ID, status (running or exited (code)), command, client count.

oc exec attach <id> <session-id>

Not yet implemented. The command exists but prints guidance to use the SDK or a WebSocket client (websocat).

oc exec kill <id> <session-id>

Kill an exec session. HTTP API →
--signal
int
default:"9"
Signal number (default: SIGKILL)