Unable to login to ECR
See original GitHub issueHello. I am having issues logging in to ecr using docker-py, my code is as follows:
from docker import Client
client = Client(base_url = 'tcp://127.0.0.1:2375')
client.login(username='AWS', password=auth_code, registry='https://xxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com')
client.pull('xxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/foo:latest')
Results with the following error:
docker.errors.APIError: 500 Server Error: Internal Server Error ("error parsing HTTP 403 response body: invalid character 'Y' looking for beginning of value: "Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one."")
The thing is, auth_code
is generated from aws ecr get-login
, which works perfectly. Can any one shed some light on this?
I did some debugging and in docker/api/image.py
response is status_code 500 text:
error parsing HTTP 403 response body: invalid character 'Y' looking for beginning of value: "Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one."
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Not able to login to AWS ECR Repository through docker login ...
You need to first request for the authorization token from ECR using AWS CLI and then extract the password from it and then,...
Read more >Troubleshooting Amazon ECR error messages
This indicates that your user does not have permissions granted to use Amazon ECR, or that those permissions are not set up correctly....
Read more >AWS ECR get-login-password not working
If the AWS ECR get-login-password not working, worry not. Our experts are offering troubleshooting tips to fix the issue. Click to read.
Read more >ECR docker login issues with CLI v2 #4962 - GitHub
I'm unable to run "aws ecs update-service --force-new-deployment --cluster {{cluster-name}} --service {{service-name}}" command after upgrading ...
Read more >Please help - Cannot login to ECR repository - CircleCI Discuss
config.yml version: 2.1 orbs: aws-ecr: circleci/aws-ecr@8.1.2 jobs: build: machine: image: ubuntu-2204:2022.04.2 steps: - checkout - run: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found it helpful to delete the Amazon login credentials from ~/.docker/config.json as well. The token is only good for 12 hours.
It looks like somewhere in the login process the local version is finding what it thinks is an auth and so the login uses the cached result. Adding
reauth=True
to the login call fixes it. Sorry for the rabbit hole Tomas.