Cordium documentation · Latest
CLI
The cordium CLI is the primary tool for day-to-day Workspace management from a terminal, as well as for scripting and automation. It provides access to the full Cordium API with a command structure designed around common workflows, which is quite similar to the octelium and octeliumctl CLIs.
Read in detail on how to install the cordium CLI here.
Domain and Global Flags
Since the CLI is designed to work with multiple Clusters, you need to inform it of your Cluster's domain either via the --domain flag in every command or, more conveniently, via the OCTELIUM_DOMAIN environment variable:
Every command also supports the following global flags:
| Flag | Description |
--domain | The Cluster domain. Overrides the OCTELIUM_DOMAIN environment variable. |
--homedir | Overrides the Octelium home directory where the authentication state is stored. |
--logout | Logs out after executing the command. Useful in ephemeral environments such as containers. |
Authentication
The cordium CLI shares its authentication state with the octelium and octeliumctl CLIs. In other words, once you log in via any of them, all of them are authenticated with the same Session. If you're not logged in, any cordium command automatically opens a browser window for you to authenticate via the Cluster's identity providers. You can also explicitly log in and out via the octelium CLI (read more here):
For non-interactive environments such as CI pipelines, containers and AI agent orchestrators, a WORKLOAD User can authenticate without any login step via the following environment variables:
| Environment variable | Description |
OCTELIUM_AUTH_TOKEN | An authentication token Credential (read more here). |
OCTELIUM_AUTH_ASSERTION | An OIDC-based assertion for secretless workload authentication, e.g. from GitHub Actions or Kubernetes (read more here). |
OCTELIUM_ACCESS_TOKEN | An already issued access token (read more here). |
Here is an example:
You can show your User, Session and Cluster information as follows:
Resource Names
Workspaces are referred to by their Cluster-assigned names (e.g. abc, x7k2). Other resources are referred to by their names, which the Cluster completes for you relative to your User (read more about resource names here). For example, for the User alice:
| You type | Resolves to |
--space research | The USER Space research.alice |
--space payments.cordium | The ORGANIZATION Space payments.cordium |
--template api-dev | The Template api-dev of alice's default Space (i.e. api-dev.default.alice) |
--template api-dev.research | api-dev.research.alice |
--template api-dev.payments.cordium | api-dev.payments.cordium |
--snapshot before-upgrade | before-upgrade.alice |
Running Workspaces
cordium run is the primary workflow command. It creates a Workspace (if no name is given) or picks an existing one, starts it if it is stopped, waits for it to be ready while showing its state, and opens an interactive terminal inside it. When the terminal session ends, the Workspace keeps running unless the --rm flag is used, in which case it is deleted. Here are some examples:
Workspace Flags
The following flags are shared by cordium run and cordium create workspace. When combined with --file, they override or extend the values of the YAML spec:
| Flag | Description |
--space | The parent Space. The Workspace is created from the Space's default Template. Mutually exclusive with --template. |
--template | The parent Template (e.g. api-dev.payments.cordium). |
--file | Path to a Workspace YAML spec file (read more here). |
--snapshot | Restores the Workspace's storage from a WorkspaceSnapshot. The Workspace is created from the Template of the snapshotted Workspace unless --template or --space is set. Mutually exclusive with --ephemeral for cordium create workspace. |
--image | A container image (e.g. ubuntu:26.04). Mutually exclusive with --dockerfile. |
--dockerfile | Path to a local Dockerfile whose content is embedded inline in the spec. COPY/ADD instructions with local context paths are not supported. |
--repository | The primary git repository, cloned into /workspace/repo. |
--branch, -b | The branch to clone. |
--depth | The shallow clone depth. |
--checkout | A specific commit, tag or ref to check out after cloning. |
--additional-repo | An additional repository in the NAME=URL format. Repeatable. |
--env, -e | An environment variable in the KEY=VALUE format. Repeatable. |
--env-from-secret | An environment variable sourced from a Secret of the Space in the KEY=SECRET_FULL_NAME format. Repeatable. |
--var | A variable in the NAME=VALUE format (read more here). Repeatable. |
--cpu, --memory, --storage | Resource limits in millicores and megabytes. |
--port | An application in the PORT, NAME:PORT or NAME:PORT:default format. Repeatable. |
--volume | Mounts a Volume of the Space in the NAME:MOUNT_PATH[:ro] format. Repeatable. |
--ephemeral | Creates an ephemeral Workspace. |
--auto-stop | Automatically stops the Workspace once all of its foreground lifecycle tasks complete. |
--read-only | Uses a read-only root filesystem. |
--cap-add, --cap-drop | Adds or drops a Linux capability. Repeatable. |
cordium run additionally supports the --rm flag, while cordium create workspace additionally supports the following flags:
| Flag | Description |
--start | Starts the Workspace immediately after its creation, without waiting for it or opening a terminal. |
--out, -o | Prints the created Workspace as yaml or json. |
--serve | Serves an Octelium Service assigned to your User from within the Workspace (read more here). Repeatable. |
--serve-all | Serves all the Octelium Services assigned to your User from within the Workspace. |
Creating Workspaces
cordium create workspace (or simply cordium create ws) creates a Workspace in the STOPPED state without opening a terminal, which is typically what scripts and CI pipelines need. Here are some examples:
Workspace Lifecycle
Inside a Workspace, cordium stop without any argument stops the Workspace itself, since the Workspace's name is available in the CORDIUM_NAME environment variable. This is useful for background tasks that need to stop their own Workspace once they are done (read more here).
Terminals
cordium terminal (or simply cordium term) opens an interactive terminal in a running Workspace. Unlike cordium run, it does not create or start a Workspace. Every invocation creates an independent terminal session inside the Workspace.
Executing Commands
cordium exec runs a single command in a running Workspace and streams its output. The command and its arguments must follow a double-dash (--) separator. stdin, stdout, and stderr are all connected and the exit code of the remote command is propagated, which makes it suitable for scripted automation. Sending Ctrl+C terminates the remote command. Here are some examples:
| Flag | Description |
--workdir, -w | The working directory of the command. |
--env, -e | An environment variable for this command in the KEY=VALUE format. Repeatable. |
--root | Runs the command as root inside the Workspace. |
--no-stdin | Disables stdin forwarding. |
Once your local stdin reaches its end, cordium exec terminates the remote command since the remote command's stdin cannot be closed independently. Therefore, always use the --no-stdin flag in scripts, CI pipelines and AI agent tools, where stdin is typically empty or closed, otherwise the command would be terminated right away. To pass files to a Workspace or to fetch files from it, use cordium cp (read more here) or the SDKs' file transfer helpers (read more here) instead of piping them through cordium exec.
Logs
cordium logs streams the initialization logs of a Workspace in real time, including the image pull and build output, the repository clone output, and the stdout and stderr of all the lifecycle tasks. Logs are streamed live while the Workspace is starting or running, which makes them the first place to look when a Workspace is slow to start or when a task misbehaves. They are not available anymore once the Workspace has stopped, in which case its status.failure field (e.g. via cordium get ws abc -o yaml) reports why its last run failed.
SSH and File Transfers
cordium ssh opens an SSH session to a running Workspace through the Cluster's identity-aware SSH proxy, while cordium cp copies files and directories between your machine and a Workspace or between two Workspaces over SFTP. Both require you to be connected to the Cluster via octelium connect:
Read the complete guide on SSH access, port forwarding, file transfers and IDE integration here.
Snapshots
Read more about WorkspaceSnapshots here.
Volumes
Read more about Volumes here.
Spaces and Templates
cordium create template supports the --file (-f), --image, --dockerfile, --repository, --branch, --depth, --checkout, --env, --env-from-secret, --additional-repo, --cpu, --memory, --storage and --git-provider flags. Read more about Spaces here and Templates here.
Deleting a Space deletes all of its Workspaces, Templates, Secrets, GitProviders and Memberships.
Secrets, UserSecrets and GitProviders
Read more about Secrets and GitProviders here and UserSecrets here.
Listing and Output Formats
Every cordium get command prints a table by default and supports the -o yaml and -o json output formats, which print the full resources, including their full names and statuses:
Here is an example of the table output:
Cluster Management
The cordium man commands manage the Cluster-wide Cordium configuration (read more here). They require your User to be authorized to use the Cordium ManagementService (read more here).
Using the CLI Inside Workspaces
The cordium, octelium and octeliumctl binaries are automatically available inside every Workspace, and they are already authenticated as the Workspace's owner through the Workspace's own Session, without any token stored inside the Workspace. This means that a script or an AI agent running inside a Workspace can manage your other Workspaces as follows:
The actions are authorized exactly as if you performed them yourself. You can still restrict what Workspace Sessions are allowed to do with the Cordium API via Octelium Policies (read more here).
Command Reference
| Command | Description |
cordium run [WORKSPACE] | Create (or pick), start and open a terminal in a Workspace. |
cordium create workspace | Create a Workspace. Aliases: ws, workspaces. |
cordium start WORKSPACE | Start a stopped Workspace. |
cordium stop [WORKSPACE] | Stop a running Workspace. |
cordium terminal WORKSPACE | Open an interactive terminal. Alias: term. |
cordium exec WORKSPACE -- CMD | Run a command and stream its output. |
cordium logs WORKSPACE | Stream the initialization logs. |
cordium ssh WORKSPACE [-- CMD] | Open an SSH session, run a command or forward ports. |
cordium cp SRC DST | Copy files to, from and between Workspaces. |
cordium code WORKSPACE | Open VS Code inside a Workspace over SSH. |
cordium build TEMPLATE | Trigger or cancel (--cancel) a Template pre-build. |
cordium create space|template|secret|usersecret|gitprovider|volume|snapshot | Create a resource. |
cordium get workspace|space|template|secret|usersecret|gitprovider|volume|snapshot | List or show resources. |
cordium delete ... | Delete a resource. Aliases: del, rm. |
cordium man get clusterconfig | Show the ClusterConfig. |
cordium man apply PATH | Apply the ClusterConfig. |
cordium status | Show your User, Session and Cluster information. |
cordium version | Show the CLI version, or check for a newer one via --check. |