AWS Fargate Task Debugging, what does “CannotPullContainerError … invalid reference format” mean?

和自甴很熟 提交于 2021-02-08 14:04:23

问题


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.


回答1:


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




回答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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/47843530/aws-fargate-task-debugging-what-does-cannotpullcontainererror-invalid-refe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!