AWS Fargate Task Debugging, what does "CannotPullContainerError ... invalid reference format" mean?
Asked Answered
P

4

7

I have docker container stored on AWS ECR, using this container I have created Task . When I run Task over Fargate , the service moves from PROVISIONING > PENDING (red color) > STOPPED states .

There is no log either in Service Event , or CloudWatch . Absolutely no way to know what is the real problem .

Any idea which way to move, AWS document did not helped.

Pluralism answered 16/12, 2017 at 7:25 Comment(1)
I followed these [instructions] (docs.aws.amazon.com/AmazonECS/latest/developerguide/…) . And now I can see that the error it shows for Task provisioning is Status reason CannotPullContainerError: API error (500): invalid reference format . Again this does not help anyway. Any pointer on this is greatly appreciated.Pluralism
B
4

I saw this error also. In my case the problem was that I had an invalid image value in my container definition. The image is generally a repository_url and image tag as per image instructions at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html

Billybillycock answered 24/2, 2018 at 16:1 Comment(1)
Wow. Just ran into this working on a 2nd service in Fargate with a semi-complex file set up. Totally botched the image pointing to the one in the repo. Would have loved something telling me this (other than your answer)!Smokeless
U
2

The AWS Fargate has a simple but scuttle info missing , this is what has lead you to your issue .Let me explain step by step.

First step is to create a Task definition , when you do that you can define

 Entry point ["/bin/ls"]
Command     [">","/list.txt","|","echo","/list.txt"]

This is equivalient to /bin/ls > /list.txt | echo /list.txt .

Please note the spaces in between has to be replaced by comma. What AWS Farget team forgot was that in the TaskDefinition > Add Container section in the wizard , this comma delimiter echo,helloworld is provided in the text box [![enter image description here][1]][1]. But in the Task form there is not such info . This is very confusing.

One last thing , AWS Fargate has very limited info for debugging. Here are my tips

  • You can get only possible error under Cluster>Task>{TaskName}>{container} . Under reason for error.
  • If the error is very small , I always got Error Code0 , no space between Code0. Nothing on Cloud watch as well .
  • If the error text is big (may be around 20 char or > ) you will get it both in the #1 and the CloudWatch log.

Hope it helps

Uyekawa answered 18/12, 2017 at 18:23 Comment(2)
Wow this helped :)Pluralism
Is there any way to get more info about reason:Error Code0?Shrinkage
V
1

In my experience you need to add permissions in your ECR. In your repository there is a tab their called permissions. Add those permissions you think you need.

Vera answered 13/7, 2018 at 7:13 Comment(0)
S
1

As Marc mentions, this is usually a wrong DockerHub/repo image name.

In my case it was because the image name was calculated by an environment variable, in my Docker Compose file:

services:
  web:
    image: scipilot/my-web-app:$MY_VERSION_TAG

And I'd missed setting the environment variable when using ecs-cli compose service up. So Fargate was probably trying to pull "scipilot/my-web-app:" from Docker Hub, hence an invalid format error.

Shiller answered 14/12, 2018 at 3:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.