CannotPullContainerError

CannotPullContainerError

本文介绍了停止(CannotPullContainerError:API 错误(500)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Amazon Fargate 集群上运行任务时收到此错误.以前有人遇到过这种情况吗?

解决方案

转到文档以获得此问题的答案.

https://docs.aws.amazon.com/AmazonECS/最新/开发者指南/task_cannot_pull_image.html

既然您遇到了 500 错误,我会听取第一个错误描述连接超时"的建议:

当 Fargate 任务启动时,其弹性网络接口需要一条到 Internet 的路由来拉取容器镜像.如果您在启动任务时收到类似以下错误,则是因为不存在通往 Internet 的路由:

CannotPullContainerError:API 错误(500):获取 https://111122223333.dkr.ecr.us-east-1.amazonaws.com/v2/:net/http:请求在等待连接时被取消

要解决此问题,您可以:

  • 对于公共子网中的任务,在启动任务时为自动分配公共 IP 指定 ENABLED...

  • 对于私有子网中的任务,在启动任务时为自动分配公共 IP 指定 DISABLED,并在您的 VPC 中配置 NAT 网关以路由请求到互联网...

如果您遇到与 ECS 任务相关的任何其他问题未启动或在启动时表现出奇怪的行为,请查看 ECS 故障排除主题.

我遇到了类似的错误(404 而不是 500),但是,即使详细状态列出了错误,任务仍显示它正在运行.>

事实证明,ecs-tasks 无法承担与任务关联的角色(在本例中与运行它的 EC2 实例的角色相同).向角色添加以下信任关系语句解决了问题:

{效果":允许",校长":{服务":ecs-tasks.amazonaws.com"},动作":sts:AssumeRole"}

请参阅任务执行角色上的特定页面,了解更多详情.

I'm getting this error when running a task on my Amazon Fargate cluster. Has anyone seen run into this before?

解决方案

Go to the docs for an answer to this one.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_cannot_pull_image.html

Since you are encountering a 500 error, I would heed the advice of the first error's description, "Connection timed out":

If you encountering any other issues relating to ECS Tasks not starting or exhibiting weird behavior upon starting, then check the full list of ECS troubleshooting topics.

I was encountering a similar error (404 instead of 500), however, the Task displayed that it was RUNNING even though the detailed status listed an error.

It turns out that the role associated with the task (same role as the EC2 Instance on which it was running, in this case) could not be assumed by ecs-tasks. Adding the following trust relationship statement to the role resolved the issue:

{
  "Effect": "Allow",
  "Principal": {
    "Service": "ecs-tasks.amazonaws.com"
  },
  "Action": "sts:AssumeRole"
}

See the specific page on the Task Execution Roles for more details.

这篇关于停止(CannotPullContainerError:API 错误(500)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:43