1

I have built an container and run successfully by aws ecs fargate. The container will download file form s3, process and upload file to s3. But because the ecs service restart policy, the service will restart a container which I don't want.

In Kubernetes, I use restartPolicy: OnFailure, but I have read the doc for ecs, all the task definition and service definition. The closest parameter I find is "dockerLabels", set the set "--restart": 'no', but it didn't work.

How can I do to not let the container restart in ecs?

4

1 回答 1

2

您所描述的内容与手动或按计划运行 ECS 任务的用例一致。与使用服务调度程序运行任务不同,这些任务不会重新启动,是一次性或定期批量执行工作负载的理想选择。您可以从 AWS 控制台或使用RunTask API手动运行任务。任务可用于模仿 Kubernetes 中的 Jobs 和 CronJobs。

服务将始终保持所需数量的任务,并且无法修改此行为:

如果您的任何任务因任何原因失败或停止,Amazon ECS 服务计划程序会启动您的任务定义的另一个实例来替换它,并根据使用的计划策略维持服务中所需的任务数。

于 2018-08-06T06:35:52.740 回答