5

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.

Yogu
  • 9,165
  • 5
  • 37
  • 58

1 Answers1

1

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.

Mano Marks
  • 8,761
  • 3
  • 27
  • 28
  • Thanks for the reply, but there doesn't seem to be an event for *failed to deploy container due to lack of resources*, or am I missing something? – Yogu Aug 08 '16 at 13:21
  • I tried it out, there are no events triggered when containers can not be scheduled due to lack of resources. – Yogu Aug 08 '16 at 20:19
  • It would be great to post this in the issue tracker: https://github.com/docker/docker/issues – Mano Marks Aug 11 '16 at 23:33