Skip to main content
Switch to a different cluster context, changing which cluster your commands interact with.

Usage

uc context use [CONTEXT]

Arguments

CONTEXT
string
Name of the context to switch to. If not provided, you’ll be shown a list to choose from.

Examples

Switch to a specific context

uc context use production
Output:
Current cluster context is now 'production'.

Choose from a list

If you don’t specify a context name:
uc context use
You’ll see an interactive selection:
Select a cluster context
> default (current)
  production
  staging
Use arrow keys to select and press Enter.

How It Works

Changing the context updates ~/.config/uncloud/config.yaml to set the current context. All subsequent commands will interact with the selected cluster.

Current Context

Check which context is currently active:
uc context ls
The current context has a ✓ in the CURRENT column.

Override Context

You can override the current context for a single command using the --context flag:
uc --context production service ls
This doesn’t change your default context.

Use Cases

Switch Between Environments

Develop on staging, deploy to production:
uc context use staging
uc deploy

uc context use production
uc deploy

Manage Multiple Clusters

Switch between different customer clusters:
uc context use customer-a
uc machine ls

uc context use customer-b
uc machine ls

Avoid Mistakes

Always verify which context you’re using before running destructive commands:
uc context ls
uc service rm database  # Make sure you're in the right context!

Build docs developers (and LLMs) love