Auto-scaler for Docker Swarm services
863
Lightweight auto-scaler for Docker Swarm services. Monitors container CPU usage across cluster nodes and scales replicas up/down based on configurable thresholds.
Runs as a single container on a Swarm manager node. Periodically collects CPU stats from all running tasks across the cluster, then adjusts replica counts for services that opt in via labels.
| Label | Default | Description |
|---|---|---|
autoscaling | — | Set to true to enable auto-scaling |
min-replicas | 1 | Minimum replica count |
max-replicas | 5 | Maximum replica count |
scale-up-cpu | 70 | CPU % threshold to add a replica |
scale-down-cpu | 30 | CPU % threshold to remove a replica |
| Variable | Default | Description |
|---|---|---|
MANAGER_HOST | tcp://localhost:2375 | Docker manager API endpoint |
DOCKER_API_PORT | 2375 | Port for worker node Docker APIs |
FREQUENCY | 60000 | Evaluation interval in milliseconds |
services:
orchestrator:
image: dbohry/local-orquestrator
environment:
- MANAGER_HOST=tcp://manager:2375
- FREQUENCY=30000
deploy:
placement:
constraints:
- node.role == manager
my-app:
image: my-app:latest
deploy:
labels:
autoscaling: "true"
min-replicas: "2"
max-replicas: "10"
scale-up-cpu: "80"
scale-down-cpu: "20"
replicas: 2
Runs with -Xmx32m — designed for always-on operation with minimal overhead.
Content type
Image
Digest
sha256:6b48f8d72…
Size
37.3 MB
Last updated
9 days ago
docker pull dbohry/local-orquestrator