尝试将 Docker 连接到 ECS 存储库时无法从非 TTY 设备执行交互式登录

sum*_*tty 3 amazon-web-services amazon-ecs docker

我正在尝试将本地 docker 映像推送到我创建的 ECS 存储库中。

按照此链接链接

aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin xxxxxxxxxxxx.dkr.ecr.region.amazonaws.com --profile loadeo
Run Code Online (Sandbox Code Playgroud)

错误:

unknown flag: --profile
Unable to locate credentials. You can configure credentials by running "aws configure".
Run Code Online (Sandbox Code Playgroud)

我还提到了这个问题上的堆栈溢出问题。这里接受的答案是使用 awscli 版本二。我觉得我有 cli 版本 2

aws --version
aws-cli/2.0.19 Python/3.7.7 Windows/10 botocore/2.0.0dev23
Run Code Online (Sandbox Code Playgroud)

在上面的命令中,如果我不使用 --profile 我会收到错误。

aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin xxxxxxxxxxxxxx.dkr.ecr.region.amazonaws.com



 Unable to locate credentials. You can configure credentials by running "aws configure".
Error: Cannot perform an interactive login from a non TTY device
Run Code Online (Sandbox Code Playgroud)

我在这里缺少什么?有人可以帮我解决这个问题吗?

Mr.*_*Mr. 5

如果您需要使用aws 命名的配置文件,那么您可以使用aws cli 列出配置文件

aws configure list
Run Code Online (Sandbox Code Playgroud)

找到配置文件后,将其与get-login-password结合使用

aws ecr get-login-password \
  --region <region> \
  --profile <profile> \
| docker login \
  --username AWS \
  --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
Run Code Online (Sandbox Code Playgroud)