使用dockerfile克隆私有git仓库
我复制了这个代码从似乎是各种工作dockerfiles,这里是我的:
FROM ubuntu MAINTAINER Luke Crooks "" # Update aptitude with new repo RUN apt-get update # Install software RUN apt-get install -y git python-virtualenv # Make ssh dir RUN mkdir /root/.ssh/ # Copy over private key, and set permissions ADD id_rsa /root/.ssh/id_rsa RUN chmod 700 /root/.ssh/id_rsa RUN chown -R root:root /root/.ssh # Create known_hosts RUN touch /root/.ssh/known_hosts # Remove host checking RUN echo "Host bitbucket.org\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config # Clone the conf files into the docker container RUN git clone [email protected]:Pumalo/docker-conf.git /home/docker-conf
这给我的错误
Step 10 : RUN git clone [email protected]:Pumalo/docker-conf.git /home/docker-conf ---> Running in 0d244d812a54 Cloning into ‘/home/docker-conf‘... Warning: Permanently added ‘bitbucket.org,131.103.20.167‘ (RSA) to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 2014/04/30 16:07:28 The command [/bin/sh -c git clone [email protected]:Pumalo/docker-conf.git /home/docker-conf] returned a non-zero code: 128
这是我第一次使用dockerfiles,但从我已经读取(并从工作配置),我不明白为什么这不工作。
我的id_rsa是在我的dockerfile相同的文件夹,是我的本地键的副本,可以克隆这个repo没有问题。
编辑:
在我的dockerfile我可以添加:
RUN cat /root/.ssh/id_rsa
它打印出正确的密钥,所以我知道它被正确地复制。
我也试图做,因为noah建议和跑:
RUN echo "Host bitbucket.org\n\tIdentityFile /root/.ssh/id_rsa\n\tStrictHostKeyChecking no" >> /etc/ssh/ssh_config
这可悲的也不工作。
我的密钥是密码保护,这是导致的问题,一个工作文件现在列出下面(为帮助未来的Google)
FROM ubuntu MAINTAINER Luke Crooks "" # Update aptitude with new repo RUN apt-get update # Install software RUN apt-get install -y git # Make ssh dir RUN mkdir /root/.ssh/ # Copy over private key, and set permissions ADD id_rsa /root/.ssh/id_rsa # Create known_hosts RUN touch /root/.ssh/known_hosts # Add bitbuckets key RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts # Clone the conf files into the docker container RUN git clone :User/repo.git
相关推荐
xysoul 2020-11-03
ShangQuan0 2020-09-10
fearlessxjdx 2020-09-04
yss0 2020-08-19
young依然 2020-08-17
Crystalqy 2020-08-15
TaoTaoFu 2020-08-03
vtnews 2020-07-29
小信 2020-07-28
白开水 2020-07-19
lihy0 2020-07-18
糊一笑 2020-07-04
wzg0wzg 2020-07-04
pigsmall 2020-07-04
VFCSDN 2020-07-04
qdqht00 2020-06-28
tosim 2020-06-24
tianlong 2020-06-21
yudiewenyuan 2020-06-21