This is an error that occurred when I wanted to get an image from Docker Hub in a Fargate task. We will introduce the causes and remedies.
The main reason is that the image cannot be pulled because communication from the subnet to the external network is not possible.
I will introduce how to deal with "Cannot Pull Container Error" when starting Fargate.
If communication from the subnet set in Fargate cannot be performed to the outside, an "Cannot Pull Container Error" error will occur.
Communication from the route table associated with the subnet to the Internet gateway or NAT gateway must be allowed.
Furthermore, the above error will occur if the settings are not set to allow communication to the outside through those Internet gateways or NAT gateways.
In the case of Internet gateway, you can set it so that it can communicate with the outside by setting as follows.
By default, network ACLs are allowed to connect to the outside as shown below, but if communication is not allowed in the settings, communication with the outside is not possible.
If that doesn't work, try allowing all communication once as follows.
"Cannot Pull Container Error" was an error that occurred without being able to communicate with the outside. Please note that AWS cannot communicate with the outside if it is not set correctly.
It would be helpful if you could point out any strange or unclear points.
https://aws.amazon.com/jp/premiumsupport/knowledge-center/ecs-pull-container-error/