Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-provision new hosts with docker swarm

How can you automatically provision new machines when docker swarm detects there are not enough resources to schedule all services?

I use a setup with rancher and the docker swarm scheduler, and if there are not enough resources, the service creation fails:

exit status 1: Creating stresstest2_workerb1_1 Creating stresstest2_workerb2_1 no resources available to schedule container

I can poll for this status and call docker machine when needed, but rancher will not attempt to re-schedule the missing services. I wonder if there is a more integrated solution, maybe a hook within docker swarm that can be used to dynamically call docker-machine to create or remove machines.

I'm currently deciding between Rancher with Docker 1.11 + Docker Swarm or Docker 1.12 in Swarm Mode, so a solution for any would be fine.

like image 272
Yogu Avatar asked Nov 09 '22 11:11

Yogu


1 Answers

Are you using the new Docker Swarm Mode that came in 1.12? There isn't currently a hook in Docker Swarm for this. However with Swarm Mode, you could use the Docker Remote API to collect events that trigger it instead of polling.

like image 143
Mano Marks Avatar answered Nov 15 '22 05:11

Mano Marks