簡體   English   中英

是否可以在 jenkins 管道的 docker.withRegistry 調用中提供我的 AWS 憑證?

[英]Is it possible to provide my AWS credentials in the docker.withRegistry call in jenkins pipeline?

在我的 Jenkinsfile 中,我試圖推送我使用 docker 插件構建的圖像,如下所示:

docker.withRegistry('https://<my-id>.dkr.ecr.us-east-1.amazonaws.com/', 'ecr:us-east-1:awscreds') {
  docker.image('image').push('latest')
}

管道每次都失敗並顯示消息ERROR: Could not find credentials matching ecr:us-east-1:awscreds但我的 Jenkins 憑證中確實有我的 AWS 密鑰 ID 和密鑰,ID 為“awscreds”。
有什么可能解決這個問題?

或者,我是否可以直接提供我的憑據而不是在通話中提及憑據 ID?

我有相同的錯誤消息。 確保安裝了Amazon ECR插件並使其保持最新,並在安裝后重新啟動jenkins。

我按照你的建議做了,但仍然沒有運氣。 請在下面檢查我的腳本:

docker.withRegistry("<account-number>.dkr.ecr.us-east-1.amazonaws.com/<service>", "ecr:us-east-1:aws-ecr-role") 
{
    dockerImage.push()
}    
  

錯誤:找不到與 aws-ecr-role 匹配的憑據

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM