kubernetes - 使用 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
管道:
- 名称:发布步骤:
- publishImageConfig: dockerfilePath: ./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.
解决方案
找到了解决方案。备查。
注册表应该是:注册表:index.docker.io
在文档中找不到这个,但是在使用 Rancher UI 重建这个管道后,它会显示这个注册表值。要完成这项工作,还需要创建一个注册表凭据。这可以在 secrets -> Registry Credentials -> add new
推荐阅读
- python-3.x - RotatingFileHandler 在 Python 3.8 中是线程安全的吗?
- javascript - JavaScript 不确定如何让 querySelectorAll() 连接到 div 类?
- css - 无需 Javascript 即可响应 CSS 工具提示
- elasticsearch - 需要解释为什么下面的弹性搜索查询会根据自定义设置和映射给出不同的结果
- mysql - Laravel:尝试捕获中的 DB::transaction() 不起作用
- python - 在 python 中导入期间没有名为“cv2”的模块
- java - Spring Hibernate查询与非主键的一对一关系
- google-calendar-api - 如何从我的 Google 日历中导出空闲/忙碌状态
- php - 数组到 JSON 的转换不处理嵌套数组
- linux - 仅提取 url 段而不是 shell 脚本中的以下正则表达式?