Salta al contenuto

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

posta un anno fa2033 visualizzazioni
1 Risposta
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

ESPERTO
con risposta un anno fa
ESPERTO
verificato un anno fa
AWS
ESPERTO
verificato un anno fa
  • 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

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.