ECS“内部错误:无法标准化图像参考”

Posted

技术标签:

【中文标题】ECS“内部错误:无法标准化图像参考”【英文标题】:ECS "InternalError: failed to normalize image reference" 【发布时间】:2021-05-28 18:36:04 【问题描述】:

我们有一个 docker 镜像存储在 ECR 中,一些来自 TC 构建代理,一些来自本地开发人员机器上的构建。所有镜像都可以在本地拉取运行,但是当尝试启动基于 build TC 构建代理构建的镜像时,当 ECS 集群开始运行任务时,我们会收到以下错误。

InternalError: failed to normalize image reference "http://xxx.eu-west-1.amazonaws.com/events/name-of-contianer:tag"

我似乎在日志中找不到任何其他信息,或者在任何 ECS 文档中都没有提到规范化错误。有没有人遇到过这个错误,甚至知道它的含义!


ECS 任务定义:


  "ipcMode": null,
  "executionRoleArn": "arn:aws:iam::xxxxxxxxxxxx:role/ecsTaskExecutionRole",
  "containerDefinitions": [
    
      "dnsSearchDomains": null,
      "environmentFiles": null,
      "logConfiguration": null,
      "entryPoint": null,
      "portMappings": [
        
          "hostPort": 80,
          "protocol": "tcp",
          "containerPort": 80
        
      ],
      "command": null,
      "linuxParameters": null,
      "cpu": 0,
      "environment": [
        
          "name": "ServiceConfiguration__BasePath",
          "value": "/mobile-read-model"
        ,
        
          "name": "ServiceConfiguration__Version",
          "value": "0.1.0"
        
      ],
      "resourceRequirements": null,
      "ulimits": null,
      "dnsServers": null,
      "mountPoints": [],
      "workingDirectory": null,
      "secrets": null,
      "dockerSecurityOptions": null,
      "memory": null,
      "memoryReservation": null,
      "volumesFrom": [],
      "stopTimeout": null,
      "image": "http://xxxxxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/events/mobile-app-read-model:0.1.0-blank-read-model0011",
      "startTimeout": null,
      "firelensConfiguration": null,
      "dependsOn": null,
      "disableNetworking": null,
      "interactive": null,
      "healthCheck": 
        "retries": 1,
        "command": [
          "CMD-SHELL",
          "curl -f http://localhost/health || exit 1"
        ],
        "timeout": 5,
        "interval": 30,
        "startPeriod": 60
      ,
      "essential": true,
      "links": null,
      "hostname": null,
      "extraHosts": null,
      "pseudoTerminal": null,
      "user": null,
      "readonlyRootFilesystem": false,
      "dockerLabels": null,
      "systemControls": null,
      "privileged": null,
      "name": "mobile-read-model"
    
  ],
  "placementConstraints": [],
  "memory": "512",
  "taskRoleArn": "arn:aws:iam::xxxxxxxxxxxx:role/ecsTaskExecutionRole",
  "compatibilities": [
    "EC2",
    "FARGATE"
  ],
  "taskDefinitionArn": "arn:aws:ecs:eu-west-1:xxxxxxxxxxxx:task-definition/mobile-app-readmodel:55",
  "family": "mobile-app-readmodel",
  "requiresAttributes": [
    
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.task-iam-role"
    ,
    
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "ecs.capability.container-health-check"
    ,
    
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
    ,
    
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "ecs.capability.task-eni"
    ,
    
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
    
  ],
  "pidMode": null,
  "requiresCompatibilities": [
    "FARGATE"
  ],
  "networkMode": "awsvpc",
  "cpu": "256",
  "revision": 55,
  "status": "ACTIVE",
  "inferenceAccelerators": null,
  "proxyConfiguration": null,
  "volumes": []

【问题讨论】:

这不是有效的 ECR 图像 ID。 ECS 任务定义是什么样的?具体来说,任务定义的image属性的值是多少? @MarkB,感谢您的回复。您是绝对正确的,在检查您要求的信息时,我们意识到了问题!在部署管道中,我们错误地添加了前面带有 URL 的图像,而不仅仅是 repo 名称。更新了管道,现在一切正常! 【参考方案1】:

image 属性应为:"image": "xxxxxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/events/mobile-app-read-model:0.1.0-blank-read-model0011",,不带 http://

【讨论】:

【参考方案2】:

您需要从图像名称中删除http://

【讨论】:

以上是关于ECS“内部错误:无法标准化图像参考”的主要内容,如果未能解决你的问题,请参考以下文章

AWS ECS Fargate 不带负载均衡器用于内部服务

具有两个负载均衡器的 ECS 服务用于同一端口:内部和面向 Internet

在 ECS Fargate 上获取 CannotPullContainerError

阿里云Windows服务器远程连接,提示内部错误

阿里云Windows服务器远程连接,提示内部错误

ecs 错误:“调用...时发生错误 (ClusterNotFoundException)”