使用dockerfile克隆私有git倉庫


我復制了這個代碼從似乎是各種工作dockerfiles,這里是我的:

 

 

FROM ubuntu

MAINTAINER Luke Crooks "luke@pumalo.org"

# 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 git@bitbucket.org:Pumalo/docker-conf.git /home/docker-conf

這給我的錯誤

 

Step 10 : RUN git clone git@bitbucket.org: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 git@bitbucket.org: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 "luke@pumalo.org"

# 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 git@bitbucket.org:User/repo.git


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM