# STOPPED（CannotPullContainerError：守护进程错误响应：镜像:标签的清单未找到：清单未知）

- **ID:** `aws/ecs-task-stopped-cannotpullcontainer`
- **领域:** aws
- **类别:** runtime_error
- **错误码:** `CannotPullContainerError`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

ECS任务定义中指定的容器镜像在ECR仓库中不存在，或标签不正确。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ecs-2024 | active | — | — |
| docker-24.0.7 | active | — | — |
| amazon-ecs-agent-1.78.0 | active | — | — |

## 解决方案

1. ```
   Verify the image URI in the task definition using: aws ecs describe-task-definition --task-definition mytask:1 --query 'taskDefinition.containerDefinitions[0].image'. Then check ECR: aws ecr describe-images --repository-name myrepo --image-ids imageTag=mytag. If missing, push the correct image: docker tag myapp:latest account.dkr.ecr.region.amazonaws.com/myrepo:mytag && docker push account.dkr.ecr.region.amazonaws.com/myrepo:mytag
   ```
2. ```
   If using 'latest' tag, ensure it is explicitly pushed. ECR does not automatically tag 'latest' on push. Use: docker tag myapp:latest account.dkr.ecr.region.amazonaws.com/myrepo:latest && docker push account.dkr.ecr.region.amazonaws.com/myrepo:latest
   ```

## 无效尝试

- **** — 重复部署相同的任务定义不会改变镜像URI，错误持续存在。 (100% 失败率)
- **** — 错误是关于镜像是否存在，而不是访问权限；权限问题会显示不同的错误消息。 (50% 失败率)
