【问题标题】:How to pull private images from GCR in drone?如何从无人机的 GCR 中提取私有图像?
【发布时间】:2018-07-05 10:17:40
【问题描述】:

我一直在研究如何拉取私有图像,我找到了this

我正在尝试使用无人机 cli,但是当我使用此命令时

drone registry add \
  --repository octocat/hello-world \
  --hostname gcr.io \
  --username _json_key \
  --password @/absolute/path/to/keyfile.json

它返回一个错误: Client error: 404

有什么帮助吗?

【问题讨论】:

    标签: google-cloud-platform continuous-integration drone.io google-container-registry


    【解决方案1】:

    添加自定义注册表时,运行drone registry add时需要存在repo。

    您可以运行drone repo ls(显示所有回购)或drone repo info octocat/hello-world 来确认您的回购存在。

    【讨论】:

    • 我已经修好了。我拼错了存储库名称。还是谢谢。
    • 很高兴听到你想通了!
    【解决方案2】:

    我在这里有点晚了,但对我来说,这很有效(我将来会帮助其他人):

    drone exec --trusted --secret-file=secrets.txt --event=push .drone.yaml
    

    使用 --trusted 我能够下载需要身份验证的私有图像,使用 secrets.txt 文件通过(在我的情况下是 Google 图像)。

    在drone.yaml中:

        pull: if-not-exists
        image: eu.gcr.io/private-org/private-repo/latest
        environment:
            GITHUB_TOKEN:
                from_secret: GITHUB_TOKEN
    

    secrets.txt 文件只包含(一个有效的)GitHub 令牌:

    GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-19
      • 1970-01-01
      • 2020-08-16
      • 2019-11-24
      • 2020-04-27
      • 2017-07-05
      • 1970-01-01
      • 2012-02-26
      相关资源
      最近更新 更多