amazon-ecs-agent icon indicating copy to clipboard operation
amazon-ecs-agent copied to clipboard

ECS Problem: cannot pull container from docker repository

Open ynelin opened this issue 10 years ago • 19 comments

Hi, guys. We have problem

Service wont start with error: Status reason CannotPullContainerError: Error: image xxx/yyyy:latest not found

We have private repository on hub.docker.com. I tried to pull container from my machine - everything is ok.

ynelin avatar Jun 10 '16 05:06 ynelin

Hi @ynelin,

Have you configured private registry authentication according to the documentation? Is this a new problem that just developed or is the first time you're trying to use a private registry? Which agent version, Docker version, and AMI are you using?

Sam

samuelkarp avatar Jun 10 '16 05:06 samuelkarp

We configured auth, It's works fine a half-year with those credentials, we have not changed nothing Agent version 1.10.0 Docker version 1.9.1 Originally, AMI was 2015.09.b but there is some updates now.

ynelin avatar Jun 10 '16 06:06 ynelin

Some info, this problem in Ireland Trying to stop container in Frankfurt - and ECS started new container without problems (using same private registry on hub.docker.com) Frankfurt instance: AMI 2016.03 Agent version 1.8.1 Docker version 1.9.1

ynelin avatar Jun 10 '16 07:06 ynelin

@ynelln Did this happen right after you updated the agent? Could you help us verify if there are some errors in ECS Agent logs located in /var/log/ecs (you should see something like "Pulling image image your-image-name")? And also could you provide us the docker logs in /var/log/docker to help us root-cause the issue?

If you're not comfortable posting this publicly, you can email me at penyin (at) amazon.com.

Thanks.

richardpen avatar Jun 10 '16 22:06 richardpen

We update client a week ago, when this happens https://github.com/aws/amazon-ecs-agent/issues/417 All works fine then.

For now, we fix all with manually "docker pull image" from docker hub. Now ecs starts stopped containers without any problems.

In /var/log/docker there is many messages

time="2016-06-10T07:09:56.939738248Z" level=error msg="Handler for POST /v1.17/containers/create returned error: No such image: foo/bar:latest"
time="2016-06-10T07:09:56.939774967Z" level=error msg="HTTP Error" err="No such image: foo/bar:latest" statusCode=404

In /var/log/ecs many messages like

2016-06-11T10:57:53Z [INFO] Error while pulling container; will try to run anyways module="TaskEngine" task="foo:3 arn:aws:ecs:eu-west-1:558122141955:task/4d83fd9e-5fba-400c-9da1-3167c76b1dd1, Status: (NONE->RUNNING) Containers: [foo (PULLED->RUNNING),]" err="Error: image foo/bar:latest not found"

It's like docker hub was unreachable, but when it happened - I tried to docker pull manually from another instance - and all was fine. Unfortunately, I do not think to immediately run docker pull on problem instance

ynelin avatar Jun 12 '16 07:06 ynelin

+1 The same issue. There is needle image in my ECR (it is in the ECR list and it can be pulled by hand). But while using ECS I have that error CannotPullContainerError

ykrevnyi avatar Jun 13 '16 16:06 ykrevnyi

@ynelin @ykrevnyi Can you clarify if you are seeing this behavior every time you use the image or if it is a transient error? We would like to rule out that it is a configuration issue and not a reach-ability issue.

Thanks

kiranmeduri avatar Jun 16 '16 00:06 kiranmeduri

@kiranmeduri Yep, if the image starts to fail with error CannotPullContainerError - it continuously fails. It basically starts working if push more images to the ecr.

For example:

  • We have image-1 (fails with CannotPullContainerError)
    • If we wait some time (1-2 days) image-1 this image still fails
  • We deploy 2-3 more images (so, at that time we have image-1, image-2, image-3, image-4)
  • We try to run image-1 (not 2, 3 or 4)
  • After 5-10 attempts it starts working. After that moment image-1 will always work.

Few days ago updated:

  • AMI to amzn-ami-2016.03.c-amazon-ecs-optimized (ami-84b44de4)
  • docker to 1.11.1
  • ecs agent to 1.10.0

Don't see issues right now.

Thing to notice is that after update it starts working fine. But in 10-15 days all of these issues come back (tested 2 times).

So, right now will monitor system and give updates soon.

ykrevnyi avatar Jun 17 '16 07:06 ykrevnyi

Strange thing appear now.

Using default tag: latest
latest: Pulling from xxx/yyy
Pulling repository docker.io/xxx/yyy
Tag latest not found in repository docker.io/xxx/yyy

But from my local machine everything is ok

Using default tag: latest
latest: Pulling from /xxx/yyy

Digest: sha256:a273bc8db4a7d7c92874de504590797101c2252288f950047ad8a914d43b15c1
Status: Image is up to date for xxx/yyy:latest

ynelin avatar Jun 29 '16 17:06 ynelin

Facing the same problem. Restarting the EC2 instances helps temporarily but the problem occurs again after some time.

schickling avatar Jul 04 '16 09:07 schickling

We had the same problem with ECS agent 1.8.2 running Docker 1.9. The agent could not pull images from our private Docker Hub repository. We were using ECS optimized image from the AWS marketplace (ami-da699cba, amzn-ami-2016.03.a).

If we tried to update the ECS agent via the ECS console, the agent crashed. However, updating our instances to use the latest ECS optimized image (amzn-ami-2016.03.d), running ECS agent 1.10.0 and Docker 1.11.1, appears to have fixed the problem.

kmjennison avatar Jul 08 '16 22:07 kmjennison

We had the same problem. In my case I was using "docker" auth format (with user and password..) in my ECS conf file. The problem seemed related to an escape char \ in my password. Changing Docker Hub password without \ it seems to work well. Note that through CLI I was able to login, the problem was with ECS-Agent. Hope this helps.

aboutvale avatar Jul 13 '16 09:07 aboutvale

What is the registry-url for public Docker images (no ECR)? It's not clear in the documentation & I even asked a question about it http://serverfault.com/questions/789274/cannotpullcontainererror-on-aws-ecs/

I'm not sure if AWS or Docker themselves are making it hard to find this information. ;)

kaihendry avatar Jul 19 '16 03:07 kaihendry

@kaihendry there is no registry-url if you are using Docker hub. Docker defaults to Docker Hub's registry url if one is provided in the prefix. In the case you've linked to, your image is just "hendry/count". If you had this hosted on ECR, your image would be "<aws-account=id>.dkr.ecr..amazonaws.com/hendry/count" (assuming your ECR Repository was named "hendry/count").

sentientmonkey avatar Jul 20 '16 17:07 sentientmonkey

I am experiencing a similar issue. Please advise! Docker version 1.9.1, agent version 1.8.2

Jul 20 11:28:03 4560aa758d6b ecs-agent: 2016-07-20T17:28:03Z [INFO] Sending container change module="eventhandler" event="ContainerChange: arn:aws:ecs:us-east-1:xxxxx:task/86a61fad-2cf5-429b-b52d-7825b1a50ea3 owncloud -> STOPPED, Reason CannotPullContainerError: Tag latest not found in repository docker.io/library/owncloud, Known Sent: NONE" change="ContainerChange: arn:aws:ecs:us-east-1:xxxxxxx:task/86a61fad-2cf5-429b-b52d-7825b1a50ea3 owncloud -> STOPPED, Reason CannotPullContainerError: Tag latest not found in repository docker.io/library/owncloud, Known Sent: NONE"

lodotek avatar Jul 20 '16 17:07 lodotek

@kiranmeduri Getting same issues as @ykrevnyi. Image is pulled from ECR successfully (docker run works when logging into instance) but when ECS is trying to run, fails with "error: No such container:..." every time.

Running - Docker version 1.11.2, build b9f10c9/1.11.2 on ecs optimized ami

ty-dev avatar Jul 29 '16 18:07 ty-dev

Hi all,

If you're experiencing CannotPullECRContainerError or CannotPullContainerError when using ECR, please open a new issue.

If you're experiencing CannotPullContainerError using a private registry that is not ECR (Docker Hub, your own private registry, etc), please ensure you've configured everything according to the documentation (you can verify that the settings have been picked up by looking at docker inspect ecs-agent and seeing that the settings reflected there are the same as you've configured them). If you still have trouble, https://github.com/aws/amazon-ecs-agent/issues/273#issuecomment-168100078 has guidance on looking at the Docker daemon logs to see what specifically is going wrong.

I'm closing this issue for now as the most frequent cause of errors here is a problem with the configuration (malformed, typos, etc).

Thanks, Sam

samuelkarp avatar Aug 23 '16 23:08 samuelkarp

Just stumbled upon the CannotPullContainerError and found this ticket. On our ECS cluster it also suddenly stopped working. Login to our private registry was fine, though.

It turns out, that one of the EC2 instances ran out of disk space.

pstorch avatar Nov 11 '16 09:11 pstorch

I ran into this issue and in my case the documentation that is often referred to in the comments is wrong. For ECS_ENGINE_AUTH_DATA, I had to remove the leading and trailing ' for things to work. So something like this:

ECS_ENGINE_AUTH_DATA={"https://index.docker.io/v1/":{"auth":"zq212MzEXAMPLE7o6T25Dk0i","email":"[email protected]"}}

Hopefully, this saves someone the hours I lost on this one. @samuelkarp perhaps the documentation should be updated?

cyu avatar Feb 16 '17 14:02 cyu