Skip to main content
The 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

Install the Control Plane CLI. See Installation.
You need a running workload in at least one location. See the Create a Workload guide.
You need exec permission on the workload. See Workload Permissions.

Basic usage

The -- separates the CLI options from the command to execute.

Options

Run a simple command

Output:

Run commands with arguments

Target specific locations or replicas

Interactive mode

Combine -i (stdin) and -t (TTY) for interactive commands:
For interactive sessions, consider using cpln workload connect which provides a simpler experience.

Pipe input to commands

Use -i to pipe data into a container:

Quiet mode

Suppress CLI output and show only command output:
Useful for capturing output in scripts:

Common workflows

Check environment variables

View logs

Check disk usage

Test network connectivity

Run database queries

Troubleshooting

The command may not exist in the container. Check what’s available:
The command may require elevated permissions, or you lack exec permission on the workload.
The workload may not be running:
Ensure -- separates CLI options from the command:

Next steps

Connect to Workloads

Interactive shell access

Copy Files

Transfer files to/from workloads

Port Forwarding

Access workload ports locally

Command Reference

Full exec command reference