【发布时间】:2014-07-09 19:57:37
【问题描述】:
我正在尝试使用 Docker 从 github 克隆一个私有仓库。问题是我需要使用 ssh 来访问该仓库。我在我的 github 项目设置中添加了一个密钥,我想该密钥用于识别 docker 的服务器。
我的问题是我不知道应该在 Dockerfile 中写什么,以便服务器在尝试访问我的 github 存储库时使用该密钥。我看到了将 id_rsa 添加到容器中的示例,但我不知道 id_rsa 存储在他们的服务器上的哪个位置,如果它存在
RUN mkdir /root/.ssh/
# can't find the file id_rsa
ADD id_rsa /root/.ssh/id_rsa
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
run git clone git@github.com:user/repo.git
如何从 docker 的服务器访问我的私人仓库?
【问题讨论】:
标签: git github ssh private docker