首页 > 解决方案 > 使用 Rancher 管道将 docker 镜像推送到私有存储库

问题描述

将图像推送到 DockerHub 上的私有存储库时遇到问题。我正在开发一个成功打包图像的管道,但在执行 docker push 命令时偶然发现“访问被拒绝”。

这是一个 Rancher 实例,它启动一个 Jenkins pod 并解析一个 rancher-pipeline.yml 文件。

日志:

Registry credentials or Docker config not provided. Guest mode enabled.
# repo info adjusted for posting

Successfully built 7dae5217eb36
Successfully tagged 00000000:latest
+ /usr/local/bin/docker tag 00000000 ACCOUNT/REPO:TAG
+ /usr/local/bin/docker push ACCOUNT/REPO:TAG
The push refers to repository [docker.io/ACCOUNT/REPO:TAG]

----

time="2020-10-08T07:57:29.336029874Z" level=error msg="Upload failed: denied: requested access to the resource is denied"
time="2020-10-08T07:57:29.336163885Z" level=info msg="Attempting next endpoint for push after error: denied: requested access to the resource is denied"
denied: requested access to the resource is denied
time="2020-10-08T07:57:29Z" level=fatal msg="exit status 1"```

Pipeline

管道:


I fiddled a lot around with the registry values but with no luck. When building an pushing the image locally i can succesfully push it to my registry. 

标签: kubernetescontinuous-integrationjenkins-pipelinerancher

解决方案


找到了解决方案。备查。

注册表应该是:注册表:index.docker.io

在文档中找不到这个,但是在使用 Rancher UI 重建这个管道后,它会显示这个注册表值。要完成这项工作,还需要创建一个注册表凭据。这可以在 secrets -> Registry Credentials -> add new


推荐阅读