cpln workload run command creates a temporary workload, waits for it to become healthy, executes your command, and optionally cleans up. It’s similar to docker run - perfect for one-off tasks, debugging, and running scripts in your cloud environment.
When to use this
Run migrations
Execute database migrations in your production environment
One-off scripts
Run maintenance scripts, data processing, or cleanup tasks
Debug with clones
Clone an existing workload to debug in an isolated environment
Quick tests
Spin up temporary containers to test configurations
Prerequisites
CLI installed
CLI installed
Install the Control Plane CLI. See Installation.
Required permissions
Required permissions
You need
create and exec permissions on workloads. See Workload Permissions.Basic usage
- Creates a temporary workload using
ubuntu:22.04 - Waits for it to become healthy
- Executes the command
- Exits (workload remains unless
--rmis used)
Options
| Option | Description |
|---|---|
--clone | Clone an existing workload instead of using the default image |
--image | Use a custom image |
--rm, --remove | Delete the workload after the command completes |
-i, --interactive | Keep the session open after command execution |
--container | Target container (when cloning multi-container workloads) |
--cpu | CPU allocation (e.g., 50m, 100m) |
--memory, --mem | Memory allocation (e.g., 128Mi, 256Mi) |
--shell, -s | Shell to use for interactive mode (default: bash) |
--location | Target location |
--tag | Add tags to the temporary workload |
-c, --command | Override container command |
-a, --arg | Override container args |
Run a simple command
Use a custom image
Clone an existing workload
Run commands in an environment identical to an existing workload:my-app with all its configuration (env vars, secrets, identity) and runs the command.
Target a specific container
For multi-container workloads:Automatic cleanup
Delete the temporary workload after the command completes:Interactive mode
Stay in the container after the command runs:Specify a shell
Common workflows
Run database migrations
Debug in a cloned environment
Run data processing
Test in a specific location
Add tags for tracking
Resource configuration
Override CPU and memory for resource-intensive tasks:Override container command
Replace the container’s default command:sleep infinity instead of its default command, then opens a bash session.
Troubleshooting
Workload never becomes ready
Workload never becomes ready
The location may not be available in your GVC:Verify the location is in the GVC’s
staticPlacement.locationLinks.Command not found
Command not found
The default Ubuntu image may not have your tool. Use a custom image:
Shell not available
Shell not available
Specify a different shell:
Timeout waiting for workload
Timeout waiting for workload
The workload may take longer to start. Check the GVC locations and image availability.