2014-02-19 7 views
3

dockerfile을 작성하여 개인 repo를 복제하려고합니다. 나는했습니다 나는이 작업을 수행 할 수있는 권리 코드를 추가 한 생각하지만,이 오류가 던지는 유지 : 나는 경로가 키가에 있음을 잘하고 있는지 확인했습니다Dockerfile에서 내 개인 SSH 키를 찾을 수 없습니다.

build: id_rsa: no such file or directory 

을, 그리고 다른 많은 시도 ssh_config에서 IdentityFile의 주석 처리를 제거하는 것과 같이 여기서 제안 된 솔루션. 여기 내 dockerfile입니다 :

FROM ubuntu:latest 
MAINTAINER John Fink <[email protected]> 
RUN apt-get update # Thu Nov 7 22:40:44 EST 2013 


RUN apt-get install -y mysql-client mysql-server apache2 libapache2-mod-php5 pwgen  python-setuptools vim-tiny php5-mysql git 

RUN easy_install supervisor 

ADD id_rsa /root/.ssh/id_rsa 
ADD known_hosts /root/.ssh/known_hosts 
RUN echo " IdentityFile /root/.ssh/id_rsa" >> /etc/ssh/ssh_config 

RUN cd /var/www 
RUN git clone [email protected]:eric/hartshorn-portraiture.git 

ADD ./start.sh /start.sh 
ADD ./foreground.sh /etc/apache2/foreground.sh 
ADD ./supervisord.conf /etc/supervisord.conf 
RUN chmod 755 /start.sh 
RUN chmod 755 /etc/apache2/foreground.sh 
EXPOSE 80 
CMD ["/bin/bash", "/start.sh"] 
+1

'/ root/.ssh' 디렉토리가'ADD id_rsa/root/.ssh/id_rsa' 줄 앞에 있다는 것을 알고 계십니까? –

답변

4

Dockerfile이있는 현재 디렉토리에 id_rsa 파일이 있습니까?

+0

나는 바보입니다. "루트"가 Dockerfile이 아닌 내 컴퓨터의 루트를 가리키고 있다고 생각했습니다. 감사 – prospekt

1

내가 볼 수있는 더 무력 버전을했고,

FROM ubuntu 
RUN apt-get -yq install ssh 
ADD .ssh /root/.ssh/ 
CMD  bash 

것은 하드 실패 -

[email protected]:~/src/docker/tmp$ docker run -rm -t -i test 
[email protected]:/# ls -la /root 
total 20 
drwx------ 3 root root 4096 Feb 20 04:12 . 
drwxr-xr-x 45 root root 4096 Feb 20 04:17 .. 
-rw-r--r-- 1 root root 3106 Apr 19 2012 .bashrc 
-rw-r--r-- 1 root root 140 Apr 19 2012 .profile 
drwx------ 2 1000 1000 4096 Feb 20 04:04 .ssh 
[email protected]:/# ssh [email protected] 
Bad owner or permissions on /root/.ssh/config 
[email protected]:/# chown -R root:root /root/.ssh/ 
[email protected]:/# ssh [email protected] 
Linux mini 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 

그래서 방금 할 필요가 말할 것 a

RUN chown -R root:root /root/.ssh 

당신은 잘 가야합니다.

관련 문제