Skip to main content
Install the Control Plane CLI inside container images to use it in CI jobs, Cron Workloads, or custom automation containers.

When to use this

Install cpln in a container image for:
  • CI/CD jobs - Run cpln commands in containerized pipelines
  • Cron Workloads - Execute automation tasks in Control Plane cron workloads
  • Custom automation images - Bundle cpln with your tools and scripts
Never bake credentials into container images. Pass tokens at runtime via environment variables or secret managers.

Installation methods

Use this method if your base image already includes Node.js (16 or later).
Dockerfile
Build and run:
bash
Exec into the container:
bash
Test the CLI:
bash
Cleanup:
bash

Pin the CLI version

Always pin the CLI version for reproducible builds:
Check available versions:

Runtime authentication

Pass secrets via environment variables

Set at minimum CPLN_TOKEN when running the container:
Never print CPLN_TOKEN in logs or commit it to version control.

Using cpln in automation

Once installed, execute CLI commands from your application code:

Common workflows

Build and push images

Apply resources

Execute workload commands

Troubleshooting

Verify the binary is in PATH and executable:
Ensure the binary is copied to a directory in PATH (e.g., /usr/local/bin).
  1. Verify CPLN_TOKEN is set at runtime:
  2. Check the token isn’t truncated
Re-run Docker login in your container:
Ensure the service account has access to the image registry.
For more troubleshooting help, see the Troubleshooting page.

Best practices

Keep final images small by using multi-stage builds to separate download/build tools from the runtime image.
Always specify an exact CLI version for reproducible builds:
Pass tokens at runtime via environment variables or secret managers. Never include them in the image.
Set CPLN_ORG and CPLN_GVC as environment variables so you don’t need to pass --org and --gvc flags with every command:
Add a verification step:
This catches installation issues during the build.

Next steps

CI/CD Usage

Complete CI/CD automation guide

Installation

CLI installation methods

Authentication

Authentication strategies

Profiles

Profile management