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

查看:177
本文介绍了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天全站免登陆