gpt4 book ai didi

github - 无法使用 dockerfile 克隆私有(private)存储库

转载 作者:行者123 更新时间:2023-12-02 09:32:56 25 4
gpt4 key购买 nike

我是 Docker 新手,所以正在尝试所有基本的东西。

我使用以下 dockerfile 来生成我的工作 docker 镜像

FROM ubuntu:14.04

MAINTAINER Alok Agarwal "alok.alok.com"

RUN apt-get update

#Install git
RUN apt-get install -y git
RUN mkdir -p /root/.ssh/

ADD id_rsa /root/.ssh/id_rsa

RUN touch /root/.ssh/known_hosts

RUN chmod 700 /root/.ssh/id_rsa

RUN git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="34535d4074535d405c41561a575b59" rel="noreferrer noopener nofollow">[email protected]</a>:user/user.git

EXPOSE 80

我可以使用 ssh 在本地系统中克隆我的存储库,但是当从 docker 进行操作时,它会给出

fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

我已将 id_rsa 文件放在我的 dockerfile 所在的位置,但仍然不知道为什么它不断失败。

我是否缺少任何基本步骤。

提前感谢您的宝贵时间

最佳答案

看看我的例子,我在 dockerize app(ssh_keys/id_rsa),以及我已经上传到私有(private)存储库的公钥 key :

FROM ubuntu:14.04

MAINTAINER Alok Agarwal "alok.alok.com"

RUN apt-get update

#Install git
RUN apt-get install -y git

RUN /bin/bash -l -c "mkdir /root/.ssh"
ADD ssh_keys/id_rsa /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
RUN mkdir -p /www/app
RUN git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="15727c6155727c617d60773b767a78" rel="noreferrer noopener nofollow">[email protected]</a>:my_private_repo/repo.git /www/app

关于github - 无法使用 dockerfile 克隆私有(private)存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30779177/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com