简体   繁体   English

无法为 ECR 验证我的 AWS 凭证

[英]Unable to authenticate my AWS credentials for ECR

I have installed the latest versions of the aws-cli-2 and docker, as well as ran "aws configure" and entered my access key and secret key.我已经安装了最新版本的 aws-cli-2 和 docker,并运行了“aws configure”并输入了我的访问密钥和密钥。 I have also verified the aws.config is correct and showing the right region and output format.我还验证了 aws.config 是否正确,并显示了正确的区域和 output 格式。 My credentials in AWS are admin.我在 AWS 中的凭证是管理员。 I keep getting the following error:我不断收到以下错误:

'''Unable to locate credentials. '''无法找到凭据。 You can configure credentials by running "aws configure".您可以通过运行“aws configure”来配置凭据。 Error: Cannot perform an interactive login from a non TTY device'''错误:无法从非 TTY 设备执行交互式登录'''

Even though I have already ran 'aws configure.'即使我已经运行了“aws configure”。 I am running the commands prefixed with 'sudo' as well.我也在运行以“sudo”为前缀的命令。 Any thoughts?!有什么想法吗?! Thank you for your time!感谢您的时间!

The aws configure command was being run as the local user, whereas the ecr command was being run as sudo. aws configure命令以本地用户身份运行,而 ecr 命令以 sudo 身份运行。

If you run commands as sudo it will not have access to your local users config, it will instead default to the root users.如果您以 sudo 身份运行命令,它将无法访问您的本地用户配置,而是默认为 root 用户。

Instead ensure all commands are run as the same user.而是确保所有命令都以同一用户身份运行。

If you want to use the aws credentials file from the default location you can also specify the location via the AWS_CONFIG_FILE environment variable.如果要使用默认位置的 aws 凭证文件,还可以通过AWS_CONFIG_FILE环境变量指定位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM