You may see that ‘Docker push to AWS ECR hangs immediately and times out’ when you are working on docker and are trying to push your first docker image to ECR. Given below is the snippet of the error you might get:
The push refers to repository [xxxxxxxxxxx.dkr.ecr.ca-central-1.amazonaws.com/reponame]
714c1b96dd83: Retrying in 1 second
d2cdc77dd068: Retrying in 1 second
30aad807caf5: Retrying in 1 second
0559774c4ea2: Retrying in 1 second
285b8616682f: Retrying in 1 second
4aeea0ec2b15: Waiting
1b1312f842d8: Waiting
c310009e0ef3: Waiting
a48777e566d3: Waiting
2a0c9f28029a: Waiting
EOF
I would like to share with you the steps I took to fix the AWS ECR hanging immediately and timing out.
Why is AWS ECR hanging immediately and timing out?
AWS ECR hanging immediately and timing out because, can be seen mainly because of AWS Login issue. If you have a personal AWS account as your default credentials, then to avoid the error, add your work profile to your credentials.
This issue is mainly seen when you have multiple AWS account profiles and correct profile is not set as default profile. Once it is done, it should fix the AWS ECR hanging immediately and timing out issue immediately.
The error is also seen because of your ECR login. You have to create a ECR repo before pushing anything, if you do not do that you may see the AWS ECR hanging immediately and timing out issue.
The error can also be seen if the permissions are not set correctly.
The detailed solution to fix AWS ECR hanging immediately and timing out, is given below:
How to fix AWS ECR hanging immediately and timing out issue?
To fix the error, you have to add your work profile to your credentials in your AWS login account details. if still error isn’t fixed then you have to have a ECR repo before pushing anything and check if correct permission are set for AWS account to work it without AWS ECR hanging and timing out issue.
To fix AWS ECR hanging immediately and timing out, you will have to follow the steps mentioned below:
Step 1: AWS login Issue
To fix the error you will have to add your work profile to your credentials in your AWS login.
Please make a note, in case you have more than one AWS profiles, you have to mention your profile names on the docker login as it is shown below; but first, you have to make sure that you have run: aws configure --profile someprofile
:
aws ecr get-login-password --region us-east-1 --profile someprofile | docker login ....
This should fix AWS ECR hanging immediately and timing out.
Step 2: ECR login Issue
If the above mentioned step did not work then there is a problem with your ECR login. Make sure that you have created a ECR repo before pushing anything.
This should fix AWS ECR hanging immediately and timing out.
Step 3: Setting the Right Permissions
If the above mentioned both steps did not work then there is a problem with your permissions settings; check your “AWS permissions”.
Make sure to give the following permission: AmazonEC2ContainerRegistryFullAccess properly to your AWS work profile account.
This should fix AWS ECR hanging immediately and timing out.
Conclusion
To fix AWS ECR hanging immediately and timing out, you will have to add your work profile to your credentials in your AWS login.
You will also have to have a ECR repo before pushing anything. You will also have to check your was permissions and make sure the correct ones are set