Select Language:
If you’re trying to upload a Docker image to Amazon’s public Elastic Container Registry (ECR) and encounter errors, here’s a simple step-by-step guide to troubleshoot and fix the problem.
First, ensure you’ve created access keys for your IAM user and assigned the correct permissions. The permissions should include “AmazonEC2ContainerRegistryFullAccess” along with specific inline policies like ecr-public:GetAuthorizationToken and sts:GetServiceBearerToken, which are necessary for authentication.
Next, follow these commands to log in to the public ECR:
bash
aws ecr-public get-login-password –region us-east-1 | docker login –username AWS –password-stdin public.ecr.aws/
Replace <your-repo-alias> with your actual repository alias.
Then, tag your Docker image correctly:
bash
docker tag
And finally, push the image:
bash
docker push public.ecr.aws/
However, some users report encountering an error like this during the push:
“unexpected status from HEAD request to https://public.ecr.aws/v2/…/blobs/sha256:…: 403 Forbidden.”
This error indicates a permission or access issue. It usually means your IAM user doesn’t have the necessary permissions to access certain resources or that your authentication tokens have issues.
Here are some steps to fix this:
-
Double-check your IAM policies. Make sure your user has the “AmazonECRPublicFullAccess” policy attached, or at least the essential permissions for pulling and pushing images.
-
Verify that your login is successful and that you’re logged in to the correct region and account.
-
Refresh your login session by running the login command again.
-
Confirm that the repository alias and image names are correct and match your repository setup.
If you’ve done all this and still see the error, consider removing and recreating your access keys or contacting AWS support for further guidance.
Following these steps should help you identify whether it’s a permissions issue or something else and guide you to a successful image upload.




