docker-autoscaler: Jobs queue on existing instances instead of scaling up when capacity limit reached
Summary
GitLab Runner docker-autoscaler executor not scaling properly with multiple instances when capacity is reached. When concurrent jobs exceed current capacity, jobs queue instead of triggering new instance creation, regardless of max_instances setting.
Steps to reproduce
-
Configure runner with:
- capacity_per_instance = 2
- max_instances = 2
- idle_count = 1
-
Submit multiple concurrent jobs (4+)
.gitlab-ci.yml
test-job:
script:
- echo "Starting long running job..."
- sleep 300
- echo "Job complete"
Alternative reproduction with multiple runners:
-
Configure manager with:
- concurrent = 8
- capacity_per_instance = 2
- max_instances = 4
- idle_count = 3
- idle_time = "1h"
-
Configure runners with:
- concurrent = 2
-
Submit 6 jobs simultaneously
Expected: Jobs should distribute across 3 instances (2 jobs per instance) Actual: Jobs queue on existing instances and run sequentially despite available max_instances headroom
Actual behavior
All jobs queue up on first instance instead of triggering autoscaling to create new instances.
Expected behavior
When first instance reaches capacity (2 jobs), autoscaler should create second instance to handle additional jobs while maintaining idle_count=1.
Relevant logs
job log
Dec 04 03:44:54 - Job #8538068739 starts
Dec 04 03:45:05 - Job #8538069349 starts
[Both jobs assigned to same instance i-06e9991af2c40bc92]
Dec 04 03:42:03 - Failed to process runner error=failed to update executor: reserving taskscaler capacity: no capacity: no immediately available capacity
Environment
- GitLab Runner 17.6.0
- docker-autoscaler executor
- AWS Fleeting plugin
config.toml
concurrent = 2
[[runners]]
executor = "docker-autoscaler"
[runners.autoscaler]
capacity_per_instance = 2
max_instances = 2
idle_count = 1
Possible fixes
The taskscaler needs to properly factor in instance utilization when making scaling decisions.