Search code examples
amazon-web-servicesamazon-ec2amazon-ecsaws-fargate

AWS Fargate - CannotPullContainerError (500)?


I'm using AWS ECS to host my services. When I try to define task with fargate, I'm getting this below problem.

CannotPullContainerError: API error (500): Get https://xxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

Further I gave full permissions to access ECR in the IAM user as well. Please help me to sort out this problem.


Solution

  • Have a look here: https://github.com/aws/amazon-ecs-agent/issues/1128

    In particular, the comment by samuelkarp

    The error you are seeing below is commonly due to lack of internet access to pull the image. The image pull occurs over the network interface used by the Task, and as such shares security group and routing rules.

    Please check your configuration for the following:

    If you are launching a task without a public IP, make sure that the route table on the subnet has "0.0.0.0/0" going to a NAT Gateway or NAT instance to ensure access to the internet. If your route table has an internet gateway, this is acting like a firewall and preventing the connection from being made. If you are launching a task with a public IP, make sure that the route table on the subnet has "0.0.0.0/0" going to an internet gateway to ensure you will be able to use the public IP successfully for ingress traffic. Verify your security group rules for the Task allows for outbound access. The default here is typically All Traffic to 0.0.0.0/0. If neither of those networking changes apply to you or if they do not fix your problem, please let us know so we can further assist.