AWS ECS 在一个任务定义中启动多个容器 [英] AWS ECS start multiple containers in one task definition

查看:22
本文介绍了AWS ECS 在一个任务定义中启动多个容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一个应用程序的 docker 容器,应用程序基于输入参数运行,传递到入口点.我想为 ECS 创建一个任务定义,并在一个任务定义中并行运行多个容器,每个容器具有不同的输入参数.

I have docker container with one application, application runs based on input parameters, passed to entrypoint. I want to create one task definition for ECS and run multiple containers in parallel in one task definition with different input parameters for each container.

问题是 - 如果不在任务定义中为我的容器之一设置 essential 选项,我将无法做到这一点.但是,如果我的基本容器完成了,我不想阻止其他人.所有容器都是独立的.

The issue is - that I cannot do it without setting essential option to one of my containers in task definition. But, I do not want stop others, if my essential container finishes. All containers are independent.

可能的选择是为每个容器创建一个任务定义.但这会花费更多,因为我的应用程序不使用大量资源.

Possible option is to create one task definition per one container. But it will cost more, because my application doesn't use lot of resources.

是否有任何其他解决方案或方法可以在一个任务定义中运行多个容器而不依赖于基本选项?

Is there any other solution or approach to run multiple containers in one task definition not rely on essential option?

推荐答案

当您想要运行不同应用程序的多个容器时.建议为它们中的每一个使用单独的任务定义.

In your situation when you want to run multiple containers of different application. It is recommended to use a separate task definition for each one of them.

当我们想在我们的应用程序中运行某种 sidecar 时,我们在一个任务定义中使用多个容器,该应用程序是该任务定义的容器之一.

We use multiple containers in one task definition when we wanted to run some sort of sidecar with our application which is one of the containers of that task definition.

此外,在 ECS 中,您无需为任务定义付费,而是为您为存储和运行应用程序而创建的 AWS 资源(例如 EC2 实例或 EBS 卷)付费.您只需在使用时为使用的内容付费;没有最低费用,也没有前期承诺.

Also, In ECS you don't pay for task definition, You pay for AWS resources (e.g. EC2 instances or EBS volumes) you create to store and run your application. You only pay for what you use, as you use it; there are no minimum fees and no upfront commitments.

定价:https://aws.amazon.com/ecs/pricing/

这篇关于AWS ECS 在一个任务定义中启动多个容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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