cpln workload exec command runs commands inside a container and returns the output. Unlike connect, it’s designed for non-interactive commands and scripts, similar to docker exec or kubectl exec.
When to use this
Run scripts
Execute maintenance scripts, health checks, or one-off commands
Automation
Run commands from CI/CD pipelines or monitoring systems
Quick commands
Check environment variables, list files, or test connectivity
Scripted debugging
Run diagnostic commands and capture output
Prerequisites
CLI installed
CLI installed
Install the Control Plane CLI. See Installation.
Running workload
Running workload
You need a running workload in at least one location. See the Create a Workload guide.
Required permissions
Required permissions
You need
exec permission on the workload. See Workload Permissions.Basic usage
-- separates the CLI options from the command to execute.
Options
| Option | Description |
|---|---|
--location | Target location (defaults to first available in GVC) |
--replica | Target a specific replica (defaults to first replica) |
--container | Target a specific container (defaults to first container) |
-i, --stdin | Pass stdin to the container |
-t, --tty | Allocate a TTY |
-q, --quiet | Only print output from the remote session |
Run a simple command
Run commands with arguments
Target specific locations or replicas
- Specific location
- Specific replica
- Specific container
Interactive mode
Combine-i (stdin) and -t (TTY) for interactive commands:
Pipe input to commands
Use-i to pipe data into a container:
Quiet mode
Suppress CLI output and show only command output:Common workflows
Check environment variables
View logs
Check disk usage
Test network connectivity
Run database queries
Troubleshooting
Command not found
Command not found
The command may not exist in the container. Check what’s available:
Permission denied
Permission denied
The command may require elevated permissions, or you lack
exec permission on the workload.No replicas found
No replicas found
The workload may not be running:
Command arguments parsed incorrectly
Command arguments parsed incorrectly
Ensure
-- separates CLI options from the command: