跳至內容

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 年前檢視次數 2031 次
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

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。