17

We have a docker images being stored in ECR, some have come from a TC build agent and some have come from builds on local developer machines. All images can be pulled an run locally but when trying to start the images built on the build TC build agents we get the following error when the ECS cluster starts running the task.

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

I can't seem to find any additional info in the logs, or mention of an error for normalize in any of the ECS docs. Has anyone experienced this error, or even know what it means!


ECS Task Definition:

{
  "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": []
}
Dan Gardner
  • 1,069
  • 2
  • 13
  • 29
  • That's not a valid ECR image ID. What does the ECS task definition look like? Specifically, what is the value for the `image` attribute of the task definition? – Mark B Feb 26 '21 at 14:11
  • @MarkB, thanks for the response. You're absolutely right, in checking for the info you asked for we realised the problem! In the deployment pipeline we've incorrectly added the image with a URL in front instead of just the repo name. Updated the pipeline and all working now! – Dan Gardner Feb 26 '21 at 14:32

2 Answers2

11

The image attribute should be: "image": "xxxxxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/events/mobile-app-read-model:0.1.0-blank-read-model0011", without the http://.

Mark B
  • 183,023
  • 24
  • 297
  • 295
8

You need to remove http:// from the image name.

Baron
  • 323
  • 4
  • 10