Autoscaling in docker swarm

Hi orj123
docker swarm services can be scaled with a command, but there are not an automatic way to do that.

I’m using a combination of cadvisor and node-exporter containers running on all docker nodes, to exports the metrics to a prometheus instance. Also have a grafana portal connected to the prometheus to get nice graphs. Also grafana can send alerts using mail or telegram bot

With that you will have all containers (and nodes) metrics in prometheus, and you can easily poll prometheus with a simple curl (or whatever you want to use) and depending on the values launch a command to scale up or down. (We are using the vmware orchestrator for that)

It is a complex way but it is possible and works so well for us.

If you need more details please feel free to ask.

Regards

1 Like