AWS ECS重新启动政策 [英] AWS ECS Restart Policy

查看:367
本文介绍了AWS ECS重新启动政策的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经检查了我在ECS集群中运行的一个Docker容器,并且该容器的重启策略为空白("{{.HostConfig.RestartPolicy.Name}}").我不确定出现故障时ECS会做什么,但是我想将策略更改为一种在实例中运行的cmd失败时重新启动容器实例的策略. 是否可以在ECS集群中更改Docker容器上的重启策略?

I've inspected one of the docker containers I have running in my ECS cluster and it has a blank for the restart policy ("{{ .HostConfig.RestartPolicy.Name }}"). I'm unsure what ECS does in the case of a failure but I would like to change the policy to one that restarts the container instance if the cmd running in the instance fails. Is it possible to change the restart policy on docker containers in an ECS cluster?

推荐答案

是否可以在ECS集群中更改docker容器上的重启策略?

Is it possible to change the restart policy on docker containers in an ECS cluster?

否,ECS不支持重新启动现有容器.但是,请参阅下面的详细信息.

No, ECS does not support restarting existing containers. However, please see below for further details.

我不确定出现故障时ECS会做什么

I'm unsure what ECS does in the case of a failure

对于单个任务(由RunTaskStartTask API开始),在容器停止的情况下,ECS将不执行任何操作,除非通过DescribeTasks报告停止(退出代码和原因,如果已知). API调用以及通过CloudWatch Events.

For a single task (started by the RunTask or StartTask APIs), ECS will do nothing in the case of a container stopping except report the stop (exit code and reason, if known) through the DescribeTasks API call and through CloudWatch Events.

如果在实例中运行的cmd失败,我想将策略更改为重新启动容器实例的策略.

I would like to change the policy to one that restarts the container instance if the cmd running in the instance fails.

ECS通过服务"的概念支持此用例.服务会不断使现实(已知状态)与所需状态(包括您指定的所需运行任务数)匹配.如果由服务启动的任务停止,则该服务将创建一个新任务来替换它.服务可帮助您管理要运行,部署,绑定到负载平衡器和从负载平衡器解除绑定的副本数,响应负载平衡器运行状况检查以及与自动扩展集成,以便您的服务可以自动扩展或扩展.您可以查看文档以获得更多详细信息.

ECS supports this use-case through the concept of a "service". Services work to continuously make the reality (known state) match the desired state, including the desired number of running tasks you specify. If a task started by a service stops, the service will create a new task to replace it. Services help you manage the number of copies you want running, deployments, binding to and unbinding from load balancers, respond to load balancer health checks, and integrate with auto scaling so your service can scale in or out automatically. You can check out the documentation for more detail.

这篇关于AWS ECS重新启动政策的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆