Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
509 views
in Technique[技术] by (71.8m points)

amazon web services - I cant push Docker image to AWS ecr

I'm trying to push a Docker image from Dockerfile built to AWS ECR but when run this command:

$ aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 477629773586.dkr.ecr.eu-west-1.amazonaws.com 

appears the error:

An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws:iam::477629773586:user/albertosanmartin is not authorized to perform: ecr:GetAuthorizationToken on resource: * Error: Cannot perform an interactive login from a non TTY device

I have installed and configured those files:

~/.aws/configure:

[default]
...
[mrthink]
region = eu-west-1
output = json

~/.aws/credentials

[default]
...
[mrthink]
aws_access_key_id = ****
aws_secret_access_key = ****

Seems to the command api get other user "albertosanmartin"

Anybody could help me please ? Thanks in advance.

question from:https://stackoverflow.com/questions/66051361/i-cant-push-docker-image-to-aws-ecr

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you have your credentials configured under mrthink profile name in ~/.aws/credentials you need to pass the --profile param to the aws cli

$ aws  --profile mrthink ecr get-login-password 
--region eu-west-1 |
docker login --username AWS 
--password-stdin 477629773586.dkr.ecr.eu-west-1.amazonaws.com 

The user arn:aws:iam::477629773586:user/albertosanmartin doesnt have access to ECR

You can double-check your credentials via sts get-caller-identity call if they are which you want to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...