Usage
Arguments
Name or ID of the service to scale.
Target number of replicas. Must be greater than 0.
Examples
Scale up to 5 replicas
Scale down to 1 replica
You’ll be asked to confirm when scaling down:Scaling Up
When you scale up, new containers are created on available machines:Scaling Down
When you scale down, containers are removed. You’ll see a plan and be asked to confirm:Important Notes
Replicated Services Only
This command only works for services inreplicated mode. Global services (one container per machine) cannot be scaled.
If you try to scale a global service:
Cannot Scale to Zero
You cannot scale a service to 0 replicas. Useuc service rm to remove the service instead:
Data Loss Warning
When scaling down, containers are removed. If they have local data (not in volumes), that data will be lost. Make sure important data is stored in volumes.No Effect if Already at Target
If the service already has the target number of replicas:Use Cases
Handle Traffic Spikes
Scale up during high traffic:Development vs Production
Run fewer replicas in development:Maintenance
Scale down before maintenance:Container Distribution
Uncloud distributes containers across machines automatically. When scaling up, new containers are placed on machines with available resources.Related Commands
uc service ls- View current replica countuc ps- See which machines have containersuc run- Create a service with initial replicasuc deploy- Deploy with replica count from Compose file
