使用Rancher管道将Docker映像推送到私有存储库

时间:2020-10-08 08:28:14

标签: kubernetes continuous-integration jenkins-pipeline rancher

将映像推送到DockerHub上的私有存储库时遇到麻烦。 我正在处理一个成功打包映像但在执行docker push命令时偶然遇到“拒绝访问”的管道。

这是一个Rancher实例,它旋转Jenkins吊舱并解析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

管道:

  • 名称:发布 脚步:
    • publishImageConfig: dockerfile路径:./ Dockerfile buildContext :。 标签:REPO:TAG pushRemote:是 注册表:ACCOUNT

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. 

1 个答案:

答案 0 :(得分:2)

找到了解决方案。 供将来参考。

注册表应为: 注册表:index.docker.io

在文档中找不到此选项,但是在使用Rancher UI重建此管道之后,它将显示此注册表值。为了完成这项工作,还需要创建一个注册表凭据。可以秘密执行->注册表凭据->添加新