Amazon web services 该容器在任务定义中不存在

Amazon web services 该容器在任务定义中不存在,amazon-web-services,aws-cli,amazon-ecs,Amazon Web Services,Aws Cli,Amazon Ecs,在我的CI上,我已经通过bash脚本在AWS ECS环境上配置了部署 **deploy.sh** [...] aws ecs register-task-definition --cli-input-json file://./deploy/skeleton.json TASK_DEFINITION_ARN=$(aws ecs --output text list-task-definitions --family-prefix "${PROJECT_NAME}" --sort DESC -

在我的CI上,我已经通过bash脚本在AWS ECS环境上配置了部署

**deploy.sh**
[...]

aws ecs register-task-definition --cli-input-json file://./deploy/skeleton.json

TASK_DEFINITION_ARN=$(aws ecs --output text list-task-definitions --family-prefix "${PROJECT_NAME}" --sort DESC --query "taskDefinitionArns[0]")

aws ecs update-service \
    --cluster "${PROJECT_NAME}" \
    --service "${PROJECT_NAME}" \
    --task-definition "${TASK_DEFINITION_ARN}" \
    --force-new-deployment \
    --deployment-configuration "maximumPercent=200,minimumHealthyPercent=100" \
    --desired-count ${DESIRED_COUNT}

[...]

当我尝试使用update service部署时,cli会回答以下问题:

An error occurred (InvalidParameterException) when calling the UpdateService operation: The container backend does not exist in the task definition.
但是如果我在json中将容器名称从csharp更改为backend,部署就可以工作了

那是虫子吗?
thx

我回答这个老问题是为了给谷歌人指出一些注意事项

似乎有两个问题与此错误消息有关

第一个原因是错误本身被误导了,因为它背后的原因实际上是负载平衡器(LB)抱怨容器名称,它试图在任务定义中找到

正如问题本身一样,在创建LB时,
containerName
作为道具传递,在大多数情况下,它是第一个任务定义修订版上的容器名称之一。通过创建新任务修订更改创建LB时使用的容器名称可能会导致错误


在这种情况下,重新创建服务和/或任务定义可能会解决问题。

您在任务定义中定义的容器
名称必须与ecs\u服务的负载平衡器配置容器\u名称中的容器匹配。这将允许负载平衡器动态映射容器端口并将其连接到目标组。

也许您的定义与您尝试部署的任务定义版本不同?在我的例子中,我添加了!子功能,它也不工作。所以我添加了静态名称
An error occurred (InvalidParameterException) when calling the UpdateService operation: The container backend does not exist in the task definition.