When running Fargate tasks, encountering the following error:
"StoppedReason": "CannotPullContainerError: ref pull has been retried 1 time(s): failed to unpack image on snapshotter overlayfs: failed to extract layer sha256:c02342326b04a05fa0fc4c703c4aaa8ffb46cc0f2eda269c4a0dee53c8296182: failed to get stream processor for application/vnd.in-toto+json: no processor for media-type: unknown"
Additionally, checking the AWS Web UI:
- The ECR image referenced by the task definition has 0 size.
- The
CannotPullContainerError
will be visible in ECS task logs.
When running cdk deploy
, the following error occurs:
fail: docker push to ecr unexpected status from PUT request 400 Bad Request
- The
400 Bad Request
error occurs duringcdk deploy
. - Sometimes, even with this error, the images may still be present in ECR. Cross-check ECR to ensure images have valid sizes.
Ensure you are using the latest version of AWS CDK:
npm install -g aws-cdk
Then, try redeploying:
cdk deploy
- Delete the
cdk.out
folder:rm -rf cdk.out
- Go to AWS ECR (Elastic Container Registry) and manually delete the images that were pushed earlier.
- Re-run
cdk deploy
.
If the image size in ECR is 0.0
, try the following:
- Open
docker_autotag.py
, add an empty space or a newline, then save the file. - Do the same for your
alt-text.js
. - Re-run
cdk deploy
to force rebuilding and pushing the images.
- Check that the image sizes in ECR are not
0.0
. - Typical image sizes for a functional ECS task should be approximately 150MB for autotag and 500MB for alt-text.
If issues persist, retry the above steps in different orders:
- Update CDK
- Delete
cdk.out
& ECR assets - Modify
docker_autotag.py
&alt-text.js
- Ensure images are properly built and pushed
- If
cdk deploy
passes, verify that image sizes are not0.0
in ECR. - If the image sizes are valid in ECR, the ECS task should run successfully.
CannotPullContainerError
would no longer appear in ECS task logs.- If
cdk deploy
still throws a400 Bad Request
, cross-check ECR as images may still be correctly pushed.
This issue has been referenced in the following GitHub issues:
This issue has been fixed and will be available in an upcoming CDK package release soon.