Skip to main content
The CLI provides powerful commands for working with container images. Build locally, push to your org’s private registry, pull from external registries, and copy images between organizations.

Quick Reference

Build and Push Images

The most common workflow is building and pushing a local application:
This command:
  1. Builds your image using the Dockerfile in the current directory
  2. Tags it for your org’s private registry
  3. Pushes it to your-org.registry.cpln.io/my-app:v1
No Docker on this machine or CI runner? Add --remote to build remotely — the image is built and pushed for you: cpln image build --name my-app:v1 --remote.

Build Options

When --dir is specified, the Dockerfile in that directory is used by default. Use --dockerfile to override this behavior.

Build Arguments

--build-arg sets a value the Dockerfile reads with ARG. It takes docker’s own two forms: a NAME=value pair, or a bare NAME whose value comes from your environment.
The Dockerfile declares each one it uses:
Common uses
A build argument is not a secret. Its value becomes part of the image’s build and cache keys, and anyone who can pull the image can recover it. Use --secret for tokens, keys, and passwords.
A bare NAME that is unset in your environment sends nothing, so the Dockerfile’s own ARG default applies. A build with no Dockerfile prints a warning naming the arguments it could not consume and continues, since buildpack builds have no ARG mechanism.

Build Secrets

--secret exposes a credential to a single RUN step. Unlike a build argument, the value is mounted as a file for the length of that step only: it never lands in the image, its layers, or its build cache. The option takes docker’s own form, id=<id>[,src=<source>], and src additionally accepts a secret in your org.
The Dockerfile reads it by the same id, at /run/secrets/<id>:
Sources src accepts
A --remote build accepts only the cpln://secret/... sources. The build service resolves them itself with your credentials, so the value never leaves the platform. A file path or an environment variable is rejected.
Add required=true to the mount. Without it, a missing secret mounts nothing and the build carries on with an empty credential, which usually surfaces much later as a confusing authentication error.
Build secrets require Docker Buildx for local builds, and a Dockerfile in either mode. Buildpack builds cannot consume secrets, so the build is rejected before it starts.

Use Images in Workloads

Reference your pushed images when creating workloads:

Image Reference Formats

Authenticate Docker

For direct Docker operations, authenticate to your org’s registry:
Then use standard Docker commands:

List and Manage Images

Copy Images Between Orgs

Copy an image to another organization:
Copy with a different name:
For cross-org copies with different credentials, use --to-profile. See the Copy Images guide.

CI/CD Authentication

For automated pipelines, set CPLN_TOKEN in your CI/CD platform’s secrets (e.g., GitLab CI/CD variables, GitHub secrets) and use the CLI directly:
The CLI automatically uses CPLN_TOKEN when available. On runners without a Docker daemon, swap --push for --remote and the image is built and pushed remotely instead:
For direct Docker access, authenticate with a service account:
See CI/CD Usage for complete automation setup.

Troubleshooting

Start Docker, or build without it:
A remote build uploads the whole build folder. Exclude what the build does not need by adding the large paths to .dockerignore, then re-run the build.
Docker Buildx is not installed. Install it:
Re-run cpln image docker-login to refresh credentials and double check that you don’t have typos in the org name.
Buildpack builds have no secret mechanism, so the option is rejected before the build starts. Add a Dockerfile to the build context, or drop --secret.
Local builds mount secrets through Buildx, which is not installed. Install the plugin as shown above, or build remotely with --remote.
The id in --secret id=<id> and the id in RUN --mount=type=secret,id=<id> must match. When they do not, BuildKit mounts nothing and the build continues silently. Add required=true to the mount so the build fails at that step instead.
A structured secret holds several fields, so the reference must select one:
The message lists the fields the secret carries. An opaque secret needs no field, since it holds a single value.
Verify you have push permission on images. Check your policies or refresh your service account token.
Optimize your Dockerfile:
  • Use multi-stage builds
  • Start from smaller base images
  • Remove unnecessary files

Learn More

Buildpacks Guide

Language-specific conventions for building without Dockerfiles

Push Images

Detailed guide for building and pushing images

Pull Images

Configure workloads to pull from private registries

Image Command Reference

Full command documentation