---
title: "CannotPullContainerError on ECS: missing image, denial or timeout | Proofline"
description: "Read the text after CannotPullContainerError to sort the failure into a missing image, a refused request or a network timeout."
url: https://proofline.sh/learn/ecs-cannotpullcontainer-image-not-found/
---

[Learning center](/learn/)

# CannotPullContainerError on ECS: missing image, denial or timeout

Read the text after CannotPullContainerError to sort the failure into a missing image, a refused request or a network timeout. For a missing image, ask ECR for the exact reference in the failed revision: batch-get-image either returns the image or names a failure code, and your own read succeeding while the task's pull was refused points at the task's credentials.

Deployment failures The Proofline team November 22, 2026 7 min read

## Three failures share one category

A task that stops with stop code `TaskFailedToStart`, no `startedAt` and a reason beginning `CannotPullContainerError` never ran its image, so it wrote no application logs. AWS groups several unrelated failures under that one category, and each needs a different fix. The words after the category name the failing step. The examples below are AWS's documented examples; AWS has reworded stopped-task messages since, so match on the HTTP status or the key phrase, not the full line. [CannotPullContainer task errors](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_cannot_pull_image.html) · [Stopped-task message updates](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/stopped-tasks-error-messages-updates.html) · [Task fields](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_Task.html)

| What follows the category | Nearest cause | First read |
| --- | --- | --- |
| `API error (404)` with `repository ... not found`, or a reason that says the image or tag was not found | The reference names a repository, tag or digest that the registry does not hold | [Check the reference against the repository](#check-repository) |
| A reason that says access was denied or authentication failed | The registry holds the image but refused the task's credentials | The execution role, the repository policy, and any endpoint policy |
| `request canceled while waiting for connection`, or a reason that says the connection timed out | The task had no working network path to the registry | [Pull timeouts from private subnets](/learn/ecs-image-pull-timeout-private-subnet/) |
| `toomanyrequests` or a Docker Hub pull-rate message | A public registry throttled anonymous or free pulls | Authenticate pulls to the registry |
| `no space left on device` (EC2 only) | The container instance's disk is full | Free space on the instance |

If the reason begins with `ResourceInitializationError` and names Secrets Manager or Systems Manager, the image pull is not the failing step. See [ECS secrets startup errors](/learn/ecs-secrets-startup-errors/).

## Capture the failed task and the exact image reference

Use a read-only profile and replace the uppercase placeholders. Stopped tasks stay visible for at least one hour, so read them first. [Stopped task errors](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/stopped-task-errors.html)

```
aws ecs describe-tasks \
  --profile PROFILE --region REGION --cluster CLUSTER --tasks TASK_ARN \
  --query 'tasks[].{definition:taskDefinitionArn,deployment:startedBy,code:stopCode,reason:stoppedReason,started:startedAt,stopped:stoppedAt,containers:containers[].{name:name,image:image,digest:imageDigest,reason:reason}}' \
  --output json --no-cli-pager
```

`image` is the reference the task tried to pull. By default, ECS resolves a tag to a digest when you create or update a service, and starts the deployment's tasks from that digest. A container definition with `versionConsistency` set to `disabled` pulls the tag as written. Read what the deployment resolved from its service revision. [Container image resolution](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html) · [ContainerDefinition](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html) · [ContainerImage](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerImage.html)

```
aws ecs list-service-deployments \
  --profile PROFILE --region REGION --cluster CLUSTER --service SERVICE --max-results 5 \
  --query 'serviceDeployments[].{deployment:serviceDeploymentArn,status:status,started:startedAt,revision:targetServiceRevisionArn}' \
  --output json --no-cli-pager

aws ecs describe-service-revisions \
  --profile PROFILE --region REGION --service-revision-arns SERVICE_REVISION_ARN \
  --query 'serviceRevisions[].{definition:taskDefinition,created:createdAt,images:containerImages[].{container:containerName,image:image,digest:imageDigest}}' \
  --output json --no-cli-pager
```

A digest in `containerImages` means the tag existed when the deployment started, and the deployment's tasks pull that digest, not the tag. Ask ECR for the digest with `imageDigest=sha256:DIGEST`: if it too returns `ImageNotFound`, the image disappeared afterwards; read [lifecycle deletions](/learn/ecr-lifecycle-policy-deleted-running-image/). If the digest is found and only the tag is missing, the tag moved or was removed, the image is still there, and the pull failed for another reason; read the stopped reason again. An empty digest means ECS did not resolve one, either because resolution is disabled for that container or because it failed. AWS documents that after three failed resolution attempts the deployment continues without digests, and a deployment with the circuit breaker enabled is failed and rolled back instead. Service revisions exist only for deployments created on or after October 25, 2024. [DescribeServiceRevisions](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeServiceRevisions.html) · [ListServiceDeployments](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListServiceDeployments.html)

## Check the reference against the repository

An ECR reference has the form `ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY:TAG` or `...REPOSITORY@sha256:DIGEST`. Split it into those parts and ask the registry in that account and Region. Use the tag or the digest exactly as the failed task had it; for a digest, pass `imageDigest=sha256:DIGEST` instead of `imageTag=TAG`. [ECR image references](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html)

```
aws ecr batch-get-image \
  --profile PROFILE --region IMAGE_REGION --registry-id IMAGE_ACCOUNT \
  --repository-name REPOSITORY --image-ids imageTag=TAG \
  --query '{found:images[].{tag:imageId.imageTag,digest:imageId.imageDigest,type:imageManifestMediaType},failures:failures[].{code:failureCode,reason:failureReason}}' \
  --output json --no-cli-pager

aws ecr describe-images \
  --profile PROFILE --region IMAGE_REGION --registry-id IMAGE_ACCOUNT \
  --repository-name REPOSITORY --image-ids imageTag=TAG \
  --query 'imageDetails[].{digest:imageDigest,tags:imageTags,pushed:imagePushedAt,status:imageStatus}' \
  --output json --no-cli-pager
```

`batch-get-image` reports a missing image as a failure entry with code `ImageNotFound`, and other codes such as `InvalidImageTag` or `ImageTagDoesNotMatchDigest` for a malformed or inconsistent reference. A wrong repository name fails the whole call with `RepositoryNotFoundException`. `describe-images` adds the push time, which settles a race between the push and the deploy. [BatchGetImage](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_BatchGetImage.html) · [ImageFailure](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_ImageFailure.html) · [ImageDetail](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_ImageDetail.html)

Your CLI identity is not the identity that pulled. On Fargate the task execution role pulls from ECR and needs `ecr:GetAuthorizationToken`, `ecr:BatchCheckLayerAvailability`, `ecr:GetDownloadUrlForLayer` and `ecr:BatchGetImage`; on EC2, the container instance role needs the same ECR actions. A successful read by you proves that the image exists, not that the task could read it. [Task execution role](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html) · [Container instance role](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)

## What each combination means

| Stopped reason | Your ECR read | Reading | Change |
| --- | --- | --- | --- |
| Not found | `ImageNotFound`, no service-revision digest, no task of this deployment ever ran, and no removal record for the tag in CloudTrail's 90-day event history | The tag was never pushed to this repository, or the reference names another account, Region or repository. If the tag could have been pushed before that history begins, the cause stays open | Fix the reference in a new revision, or push the image the revision expects |
| Not found | As above, but a `PolicyExecutionEvent` or `BatchDeleteImage` names the tag's image | The image was removed before the deployment's first pull; the reference is right | Read [lifecycle deletions](/learn/ecr-lifecycle-policy-deleted-running-image/), and restore or push the image |
| Not found | `ImageNotFound` for the tag, no service-revision digest, but earlier tasks of this deployment ran | Resolution had fallen back to the tag; the tag existed and its image was removed or the tag moved | Read [lifecycle deletions](/learn/ecr-lifecycle-policy-deleted-running-image/) for the tag, using earlier tasks' digests only as history |
| Not found | Image found, `imagePushedAt` later than the task's `stoppedAt` | The deploy ran before the push finished | Order the pipeline so registration follows a completed push |
| Not found | Image found, pushed before the failure | The reference differs from what you checked; compare it character by character, including the registry ID and Region | Correct the reference |
| Not found | `ImageNotFound`, but the service revision holds a digest | The image existed at deploy time and was removed later | See [lifecycle deletions](/learn/ecr-lifecycle-policy-deleted-running-image/) |
| Access denied | Image found | The registry holds it and refused the task | Check the execution role used, a cross-account repository policy, and endpoint policies |
| Timeout | Any | The network path, not the image | See [pull timeouts](/learn/ecs-image-pull-timeout-private-subnet/) |

For a cross-account image, the repository in the image's account must allow the pulling role through its repository policy. Read it with `aws ecr get-repository-policy` in that account. [GetRepositoryPolicy](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_GetRepositoryPolicy.html)

## An illustrative deploy, two outcomes

These records are fictional. The service `orders` moves from `orders:57` to `orders:58` in deployment `ecs-svc/2211`. Revision 58 references `111122223333.dkr.ecr.us-east-1.amazonaws.com/orders:2026-11-20.3`.

| Outcome | Stopped reason | ECR read | What happened |
| --- | --- | --- | --- |
| A | `CannotPullContainerError` with a 404 naming the repository and tag | `ImageNotFound` for tag `2026-11-20.3`; the latest image was pushed at 09:41 with tag `2026-11-20.2` | The build job failed after registering revision 58, so the tag was never pushed. The service revision holds no digest. Rerun the push, or register a revision with an existing tag. |
| B | `CannotPullContainerError` saying access was denied | The image is found, pushed at 09:52, six minutes before the deploy | Revision 58 also switched to a new execution role that lacks `ecr:BatchGetImage`. The image is fine; the role is not. |

Outcome B looks like a missing image to anyone who reads only the first word, and the fix for A (pushing again) would change nothing.

## Confirm on the replacement

After the change, a replacement task from the new deployment should have a `startedAt` and a container `imageDigest`. Compare that digest with the one `batch-get-image` returned. If they match, the task ran the image you checked. If the fix was a new revision, also check that the service revision's `containerImages` names the same digest, so later scale-out uses it too.

## Where this check misleads

A tag can move between the failure and your read in a repository with mutable tags, so a tag that is found now may name a different image than the one the deploy resolved. Compare digests, not tags. `describe-images` returns only `ACTIVE` images unless you filter on `imageStatus`, so an image that a lifecycle rule moved to archive can look missing. The stopped reason is free text; the [signature table](/learn/aws-deployment-failure-signatures/) explains why `stopCode` is the field to sort on. A deployment that the circuit breaker rolled back is a separate question from why its tasks failed to pull. [DescribeImagesFilter](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeImagesFilter.html) · [Image tag mutability](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-tag-mutability.html)

## Questions

### Why does ECS say the image is not found when I can pull it?

Your pull used your identity, the current tag and possibly another Region or account. Compare the failed task's exact `image` reference, its account and Region, and the digest the service revision resolved with what you pulled. If all match, the task's credentials or network path are the next reads.

### Does a CannotPullContainerError task have logs?

No. The task stopped before its container ran, so the application wrote nothing. The stopped reason, the task definition revision and the registry's own records are the evidence.

### Which role pulls an ECR image for a Fargate task?

The task execution role in the task definition, or the execution-role override if the task was started with one. The task role is for code inside the container and is not used for the pull.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Which ECS task stops came from your deployment? Read the stop code](/learn/ecs-task-stop-codes/)
    
    Deployment failures The Proofline team November 22, 2026 6 min read
    
-   ### [Fix ECS ResourceInitializationError when pulling secrets](/learn/ecs-secrets-startup-errors/)
    
    Missing secrets The Proofline team November 15, 2026 8 min read
