ECS task not starting - STOPPED (CannotPullContainerError: “Error response from daemon request canceled while waiting for connection”

I managed to fix this error by enabling the public IP for every Fargate instance created with my service on ECS.

Service configuration:

  "networkConfiguration": {
    "awsvpcConfiguration": {
      "subnets": [
      "securityGroups": [
      "assignPublicIp": "ENABLED" // <-- ENABLED HERE

I found a solution that worked for me using Fargate. Their documentations states:

  1. If you're running a task using an Amazon Elastic Compute Cloud (Amazon EC2) launch type and your container instance is in a private subnet, or if you're running a task using the AWS Fargate launch type in a private subnet, confirm that your subnet has a route to a NAT gateway in the route table.

That simply means,

  1. you have to find VPC that you use.
  2. Then in the table where you have your VPC, you will find its main route table.
  3. Open the route table, then make sure you have entry that link to internet gateway.

It would look something like igw-006b1917dc348d10d. Once you have, your vpc will have access to the internet, and will be able to fetch your ECR image.

table example

Source: AWS docs

So it looks the error message has changed at some point: has steps to work through but mentions the error CannotPullContainerError: API error which might be synonymous with CannotPullContainerError: "Error response from daem?

For me at least, creating an AWS::EC2::VPCEndpoint seems to have got me further.