用于克隆私有git repo的Docker文件 [英] Dockerfile for cloning private git repo
问题描述
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屋!