Skip to main content
Remove a machine from the cluster and optionally reset it to an uninitialized state. This command stops all service containers on the machine and removes it from the cluster’s WireGuard mesh network.

Usage

uc machine rm MACHINE [flags]
Aliases: uc machine remove, uc machine delete

Arguments

MACHINE
string
required
Name or ID of the machine to remove.

Flags

-y, --yes
Do not prompt for confirmation before removing the machine.
--no-reset
Do not reset the machine after removing it from the cluster. This will leave all containers and data intact.

Examples

Remove a machine (with confirmation)

uc machine rm worker1
You’ll see the containers that will be removed and be asked to confirm:
Found 3 service containers on machine 'worker1':
• web (replicated, 1 container)
  web-abc123 • nginx:latest • Up 5 hours
• api (replicated, 2 containers)
  api-def456 • myapp:latest • Up 3 hours
  api-ghi789 • myapp:latest • Up 2 hours

This will remove all service containers from the machine, remove it from the cluster, and reset it to the uninitialised state.
Do you want to continue? (y/N)

Remove a machine without confirmation

uc machine rm worker1 -y

Remove without resetting

This removes the machine from the cluster but leaves Docker and containers running:
uc machine rm worker1 --no-reset

What Happens During Removal

With Reset (default)

  1. Container Removal - Stops and removes all service containers on the machine
  2. Cluster Removal - Removes the machine from the cluster state
  3. Machine Reset - Stops the Uncloud daemon and cleans up cluster data
  4. Config Update - Removes the machine connection from your Uncloud config

Without Reset (--no-reset)

  1. Cluster Removal - Removes the machine from the cluster state
  2. Config Update - Removes the machine connection from your Uncloud config
Containers and the Uncloud daemon continue running, but the machine is no longer part of the cluster.

Output

Removing containers
✓ Stopped and removed 3 containers

Machine 'worker1' removed from the cluster.
Machine reset initiated and will complete in the background.

Important Notes

Current Machine Limitation

You cannot remove the machine you’re currently connected to. If you try, you’ll see:
Error: cannot remove the machine you are currently connected to.
Please connect to another machine in the cluster and try again.
Use --connect flag or update 'connections' for the cluster context in your Uncloud config
Connect to a different machine first:
uc --connect root@other-machine machine rm worker1

Service Containers

All service containers on the machine will be removed. If you want to keep the services running, make sure they have replicas on other machines before removing this one.

Anonymous Volumes

Anonymous volumes (created automatically from VOLUME directives in Dockerfiles) are removed with their containers. Named volumes must be removed separately with uc volume rm.

Build docs developers (and LLMs) love