简体   繁体   English

当旧的docker容器达到指定的内存限制时,是否可以运行相同图像的新docker容器

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

我想知道是否有可能通过某种自动化的方式运行新的docker容器,以便每当旧容器达到特定的内存/ CPU使用限制时 ,旧容器就不会被杀死,而新容器会平衡负载。

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) 您可以将收集器用于cAdvisor https://github.com/google/cadvisor等指标,您可以获取有关容器的信息(也可以使用docker stats来执行此操作)

You can store this data inside a time series database like InfluxDB or prometheus. 您可以将此数据存储在时间序列数据库(例如InfluxDB或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. 我知道您正在寻找准备就绪的东西,但目前我看不到有任何工具可以解决此问题。

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. Mesos,Kubernetes或Swarm。 Swarm is evolving a lot with Docker investing heavily. Swarm在Docker大量投资的基础上发展了很多。 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. Swarm模式是1.12版中的一项新功能,它将在核心产品中进行很多编排,并且可能会为您提供一个很好的用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM