dpo60833 2014-12-12 05:32
浏览 112

Dockerhub具有多个私有存储库的自动化构建

Is there a way to connect to multiple private git repos during an automated dockerhub build? We are building golang apps and need to 'go get' other private repos as part of our build and at the moment they fail as docker can't connect to them, only the target private repo.

The main repo is fine as the deploy key is installed via Dockerhub, but any subsequent private repo imports fail.

One way around this I can see, is to build the image locally, "docker push" it to dockerhub and then pull it down on the deploy side which defeats the purpose of dockerhub and the automated build system. The other is to bake ssh keys into the base image which is not a great idea.

Does anyone have a solution to this that doesn't involve baking ssh keys into images or building locally?

Many thanks.

  • 写回答

1条回答 默认 最新

  • dongzhihong3940 2016-10-19 06:51
    关注

    single ssh-key

    If you have only one ssh-key, then adding it to the root ssh-path in the Docker container (/root/.ssh/id_rsa) should be enough to successfully pulling your repos. Depends where your private-repos are, you should probably add some other configs to the .ssh.

    multiple ssh-keys

    If you have differents ssh-keys I suggest you to create a personal token for all your repos. So you can resolve easily the problem. You should update the git-url before getting:

    [ taken from here: https://gist.github.com/shurcooL/6927554 ]

    git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
    

    With this change, you should be able to build successfully your docker-container.


    Using a vendor-tool can help you solving this. From go1.5 the vendoring feature is at disposal. We are using Glide and it stores the references only (not the wholes projects).

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!