![](/img/trans.png)
[英]Is it possible to provide my AWS credentials in the docker.withRegistry call in jenkins pipeline?
[英]Docker Image can't push to ECR via Jenkins Pipeline & docker.withRegistry
我在 aws 服務器上運行 jenkins 處理用於構建 docker 圖像的管道並在同一個 aws 帳戶上推送到 ECR
def aws_account = "https://xxxxxx.ecr.us-west-2.amazonaws.com/"
def ecr_credentials = "iam-role-arn for ecr"
docker.withRegistry(aws_account + "${ecr_repository_name}", "ecr:us-west-2:${ecr_credentials}") {
docker.image(customImage).push()
}
在推動時,我遇到錯誤 tcp:lookup 指向帳號本身
錯誤: docker.service Mar 04 10:46:13 ip-x-xxx-x-xxx dockerd[921]: time="2021-03-04T10:46:13.989576275Z" level=error msg="POST/ v1.41/auth returned error: Get https://yyyyyyy.ecr.us-west-2.amazonaws.com/v2/ : dial tcp: lookup yyyyyyy.ecr.us-west-2.amazonaws.com: no such主持人”
名字錯了
def aws_account = "https://xxxxxx.ecr.us-west-2.amazonaws.com/"
它應該是這樣的
def aws_account = "https://1234567890.dkr.ecr.us-west-2.amazonaws.com"
def ecr_credentials = "iam-role-arn for ecr"
docker.withRegistry(aws_account + "${ecr_repository_name}", "ecr:us-west-2:${ecr_credentials}") {
docker.image(customImage).push()
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.