Cannot Pull Container Error on ECS Fargate

I am trying to run my microservice on ECS Fargate. I have self hosted private docker registry. I have tried pulling the same docker image from inside the EC2 server in the same subnet as ECS Fargate service, it’s able to pull the docker image.

But, with ECS fargate, I am getting the following error:

CannotPullContainerError: inspect image has been retried 5 time(s):
failed to resolve ref
failed to do request: Head

If it’s the networking error, then it should not be accessible from the EC2 server in the same subnet as well. Looks like some issue with fargate itself.

Can anyone please help me out?

Source: Docker Questions