我正在尝试使用Amazon Container Services
的view push commands
提供的命令在亚马逊网络服务的ubuntu18.04
机器上设置amazon ECR的docker镜像
,请注意,我已经在我的ubuntu18.04
上设置了docker
,并且docker -v
的输出如下所示
ubuntu@ip-172-31-0-143:~$ docker -v
Docker version 19.03.7, build 7141c199a2
当我在ubuntu18.04上的aws cli上执行amazon容器服务提供的命令时,我收到错误信息:无法从非TTY设备执行交互式登录
我使用的命令是
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 8233251134332.dkr.ecr.us-east-2.amazonaws.com/gatling-lots
请注意,我已经成功配置了awscli,可以从aws s3 ls
查看详细信息
下面是详细的错误日志
ubuntu@ip-172-31-0-143:~$ aws ecr get-login-password --region us-
east-2 | docker login --username AWS --password-stdin
823443336.dkr.ecr.us-west-2.amazonaws.com/gatling-lots
usage: aws [options] <command> <subcommand> [<subcommand> ...]
[parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
batch-check-layer-availability | batch-delete-image
batch-get-image | complete-layer-upload
create-repository | delete-lifecycle-policy
delete-repository | delete-repository-policy
describe-images | describe-repositories
get-authorization-token | get-download-url-for-layer
get-lifecycle-policy | get-lifecycle-policy-preview
get-repository-policy | initiate-layer-upload
list-images | put-image
put-lifecycle-policy | set-repository-policy
start-lifecycle-policy-preview | upload-layer-part
get-login | help
Error: Cannot perform an interactive login from a non TTY device
输出
ubuntu@ip-172-31-0-143:~$ (aws ecr get-login --no-include-email --region us-east-2)
docker login -u AWS -p
MzQxL2c0Yks4RjVxeDg9IiwidmVyc2lvbiI6IjIiLCJ0eXBlIjoiREFUQV9LRVkiLCJleHBpcmF0aW9uIjoxNTgzNjgzNDY5fQ== https://825251119036.dkr.ecr.us- east-2.amazonaws.com
发布于 2020-05-17 23:30:55
问题不是aws,而是docker。解决方案是在docker上使用-p参数,并将对-p参数的aws登录调用包装为:
docker login -u AWS -p $(aws ecr get-login-password --region the-region-you-are-in) xxxxxxxxx.dkr.ecr.the-region-you-are-in.amazonaws.com
这需要AWS CLI版本2。
发布于 2020-03-17 18:40:12
您需要安装AWS CLI版本2。请按照此link中的说明进行操作
发布于 2021-05-02 10:13:58
我花了很长时间才发现问题出在我忘记运行aws configure
并输入正确的详细信息。这解决了我的问题。
https://stackoverflow.com/questions/60583847
复制相似问题