跳至内容

Fargate deployment can not pull from ECR

0

Hey there!

I'm getting this error while deploying a service using Fargate:

ResourceInitializationError: unable to pull secrets or registry auth: The task cannot pull registry auth from Amazon ECR: There is a connection issue between the task and Amazon ECR. Check your task network configuration. RequestError: send request failed caused by: Post "https://api.ecr.me-central-1.amazonaws.com/": dial tcp 3.28.72.11:443: i/o timeout

The service runs the tasks in a subnet that has internet gateway assigned at 0.0.0.0/0 and the task has permission to access the ECR.

Why am I getting this error and why is not the fargate deployment process compatible with the default VPC at the first place?

Thank you for any help

已提问 1 年前2014 查看次数
1 回答
2

Hello.

Since a public IP address is used to access ECR, try using a NAT Gateway or enabling public IP address attachment for the ECS task.
It should also be possible to set up a VPC endpoint using methods other than NAT Gateway.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/networking-outbound.html

You may find the following troubleshooting documents helpful.
https://repost.aws/knowledge-center/ecs-unable-to-pull-secrets

专家
已回答 1 年前
专家
已审核 1 年前
AWS
专家
已审核 1 年前
  • I'm quite confused, I've created another service that assigns public IP to the instances and everything works. Why the instance needs public IP? I thought that while the instance is being set up, the docker will ACCESS the ECR, so it needs connection to the ECR endpoint, but the ECR endpoint does not need access to the instance (via public IP). Can you please explain?

  • ECR will return a public IP address when resolving a name if you do not configure anything in VPC. Therefore, if communication using a public IP address is not possible, access to ECR will not be possible. In other words, it is necessary to give the ECS task a public IP address and access ECR via an Internet gateway or by using a NAT Gateway. By setting up a VPC endpoint, you can communicate using a private IP address.
    As you can see from the error message you shared below, it's trying to access a public IP address and failing. This means that the settings for communication using a public IP address have not been configured.

    dial tcp 3.28.72.11:443: i/o timeout

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。