【问题标题】:jenkins docker on awsaws 上的詹金斯码头工人
【发布时间】:2019-03-17 19:36:54
【问题描述】:

我正在从一个 ec2 映像运行 jenkins 并构建一个 docker 映像以推送到 ecr

我不断收到此错误

Running shell script
+ aws ecr get-login --no-include-email --region us-east-2
Unable to locate credentials. You can configure credentials by running "aws configure".

我已尝试创建凭据文件 即

touch ~/.aws/credentials and echo >> to the file

我试过了

--build-arg AWS_ACCESS_KEY_ID=xxxxxxx

我也将我的凭据添加到 Jenkins 中

如有任何帮助,将不胜感激

【问题讨论】:

  • 您是否将 Jenkins 作为容器运行?
  • Jenkins 在一个 ec2 实例上运行

标签: amazon-web-services docker jenkins amazon-ecs


【解决方案1】:

您可以通过 jenkins 用户配置 aws cli 来解决此问题。只需以 jenkins 用户身份触发此命令,并提及您的访问密钥和密钥以及 AWS 区域。

第一次更改为 Jenkins 用户

[root@symphony ~]# su -s /bin/bash jenkins 

然后配置 AWS CLI

[jenkins@symphony ~]$ aws configure
AWS Access Key ID [None]: xxxxxxxxxxxxxxxx
AWS Secret Access Key [None]: yyyyyyyyyyyy
Default region name [None]: us-east-2
Default output format [None]:

使用此命令验证 aws cli

[jenkins@symphony ~]$ aws ecr get-login --no-include-email --region us-east-2

注意:确保您的用户有权访问 ECR 和 ECS。

【讨论】:

    猜你喜欢
    • 2019-07-19
    • 2018-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-29
    • 2023-04-01
    • 2016-07-21
    • 1970-01-01
    相关资源
    最近更新 更多