Search code examples
amazon-web-servicesdockeramazon-ec2docker-registryamazon-ecs

Amazon ECS troobleshooting task start failures


I am struggling to understand the problems that prevent my task from starting on my Amazon ECS cluster. I have a task with a single container

I am currently getting some weird undocumented STOPPED (CannotPullContainerError: Error: image library/bdf) and I have no idea where to start from.

When I log into my amazon EC2 instance (Amazon linux, the default ecs-optimized image) and I run docker ps -all I only see a amazon/ecs-emptyvolume-base:autogenerated that does not correspond to my image.

I also had to manually install aws-cli and do a aws ecr get-login + a docker pull to retrieve the image that was supposed to be pulled and ran by the task. (I am using Amazon ECR registry to store the image)

Any help on how to debug this ?

STOPPED (CannotPullContainerError: Error: image library/bdf)


Solution

  • That error message indicates that you have a container in your task definition that can't be pulled. Since the error message mentions library/bdf, it indicates that one of the containers in your task definition has the image field set to bdf, meaning that the ECS agent would try to pull an image named bdf from Docker Hub. As you can see here, there is no such image on Docker Hub.

    If you're storing your images in Amazon ECR, you need to specify the full name of the image ($registryId.ecr.$region.amazonaws.com/$repository:$tag) in the image field of your task definition.