Pratyush
Pratyush

Reputation: 5

Is it possible to run a new docker container of same image when the old one reaches a specified memory limit

I am wondering if is it possible to run a new docker container by some automated means such that whenever the old container reaches a specific memory/CPU usage limit ,the old container doesn't get killed and new one balances the load.

Upvotes: 0

Views: 62

Answers (2)

Jonah Kowall
Jonah Kowall

Reputation: 597

It sounds like you need a container orchestrator for possibly other use cases. You can drive scale choices with metrics via almost any of them. Mesos, Kubernetes, or Swarm. Swarm is evolving a lot with Docker investing heavily. Swarm mode is a new feature coming in 1.12 which will put a lot of this orchestration in the core product, and would probably give you a great use case.

Upvotes: 0

GianArb
GianArb

Reputation: 1674

You mean a sort of autoscaling, at the moment I don't have a built-in solution ready to be used but I can share with you my idea:

You can use a collector for metrics like cAdvisor https://github.com/google/cadvisor you can grab information about your container (you can also use docker stats to do that)

You can store this data inside a time series database like InfluxDB or prometheus.

Create a continuous query to trigger an event "create new container" when some metrics go our of your limit.

I know that you are looking for something of ready but at the moment I don't see any tools that resolve this problem.

Upvotes: 1

Related Questions