Not able to access private ECR repo and image

0

Hello, I am storing a docker image in the private repo of ECR, and while creating task definition, it gives me an error of

Private repository credentials are not a supported authentication method for ECR repositories.

I also tried with the secret manager, but it is not working. Can someone guide me on what the proper way is? Thanks for your time.

preguntada hace 2 años3205 visualizaciones
4 Respuestas
0

Check this link it might help your case: https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html#repository-concepts

profile picture
respondido hace 2 años
0

Hello,

It sounds like your task execution role might not have the right permissions? Confirm that your ecsTaskExecutionRole has the following policy attached: AmazonECSTaskExecutionRolePolicy. The trust relationship should also look like:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "",
            "Effect": "Allow",
            "Principal": {
                "Service": "ecs-tasks.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

If that doesn't work, I would verify that if you are doing any cross-account image pulling that your ECR repository has permissions that specifically allow the arn of your ecsTaskExecutionRole like so:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowCrossAccountPull",
      "Effect": "Allow",
      "Principal": {
        "AWS": [
          "arn:aws:iam::XXXXXXXXXXXX:role/ecsTaskExecutionRole"
        ]
      },
      "Action": [
        "ecr:BatchCheckLayerAvailability",
        "ecr:BatchGetImage",
        "ecr:GetDownloadUrlForLayer"
      ]
    }
  ]
}

Hope this helps! If not, please provide more detail on your architecture and IAM details.

respondido hace 2 años
0

Hi, @grahamschuckman thanks for your reply. My AmazonECSTaskExecutionRolePolicy looks like this:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ecr:GetAuthorizationToken",
                "ecr:BatchCheckLayerAvailability",
                "ecr:GetDownloadUrlForLayer",
                "ecr:BatchGetImage",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": "*"
        }
    ]
}

and I am not doing any cross account image pulling. The image is stored is same AWS account in ECR private repo.

respondido hace 2 años
0

Have a look at this article.

https://aws.amazon.com/premiumsupport/knowledge-center/ecs-tasks-pull-images-ecr-repository/

Follow the steps related to the ECS launch type you use (EC2 or Fargate). It should fix your issue.

AWS
Michael
respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas