用于克隆私有git repo的Docker文件 [英] Dockerfile for cloning private git repo

查看:129
本文介绍了用于克隆私有git repo的Docker文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从github克隆私有git仓库。我做了一个这样的Dockerfile:

  FROM ubuntu:12.04 

运行apt-get update
运行apt-get install -y git
运行mkdir -p /root/.ssh/
添加./id_rsa /root/.ssh/id_rsa
运行git clone git @ github。 com:usr / repo.git

我用这个钥匙在本地使用这个钥匙,所以似乎我在码头工作人员中缺少一些东西。



我可能会缺少的一件事是,和<$ docker中的c $ c> $ HOME 指向 / 而不是 / root ,但我不知道是否可以相关。

解决方案

构建过程的输出是什么?



随机猜测:尝试 chmod 600 私钥。



如果仍然不工作,尝试 RUN ssh -v git@github.com (添加密钥后);输出应该解释发生了什么。


I'm trying to clone private git repository from github. I did a Dockerfile like this:

FROM ubuntu:12.04

RUN apt-get update
RUN apt-get install -y git
RUN mkdir -p /root/.ssh/
ADD ./id_rsa /root/.ssh/id_rsa
RUN git clone git@github.com:usr/repo.git

I use this repo with this key just fine locally, so it seems I'm missing something inside docker.

One more thing I may be missing is that both ~ and $HOME inside docker point to / instead of /root, but I'm not sure if that can be related.

解决方案

What's the output of the build process?

Random guess: try to chmod 600 the private key.

If it still doesn't work, try to RUN ssh -v git@github.com (after adding the key); the output should explain what's happening.

这篇关于用于克隆私有git repo的Docker文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆