Apache Dockerfile可以';找不到我的ssh私钥
我正试图建立一个dockerfile,以便它克隆一个私有回购协议。我相信我已经添加了正确的代码来执行此操作,但它不断抛出以下错误:Apache Dockerfile可以';找不到我的ssh私钥,apache,ssh,docker,Apache,Ssh,Docker,我正试图建立一个dockerfile,以便它克隆一个私有回购协议。我相信我已经添加了正确的代码来执行此操作,但它不断抛出以下错误: build: id_rsa: no such file or directory 我已经确定了路径是正确的,并且密钥在那里,并且尝试了这里提出的许多其他解决方案,例如在ssh_config中取消对IdentityFile的注释,但都没有用。这是我的dockerfile: FROM ubuntu:latest MAINTAINER John Fink <joh
build: id_rsa: no such file or directory
我已经确定了路径是正确的,并且密钥在那里,并且尝试了这里提出的许多其他解决方案,例如在ssh_config中取消对IdentityFile的注释,但都没有用。这是我的dockerfile:
FROM ubuntu:latest
MAINTAINER John Fink <john.fink@gmail.com>
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 git@dev.ploonky.com: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"]
来自ubuntu的最新版本
维护者约翰·芬克
运行apt获取更新35;美国东部时间2013年11月7日星期四22:40:44
运行apt get install-y mysql客户机mysql服务器apache2 libapache2-mod-php5 pwgen python setuptools vim tiny php5 mysql git
运行简易安装管理器
添加id\u rsa/root/.ssh/id\u rsa
添加已知的\u主机/root/.ssh/known\u主机
运行echo“IdentityFile/root/.ssh/id\u rsa”>>/etc/ssh/ssh\u config
运行cd/var/www
运行git克隆git@dev.ploonky.com:eric/hartshorn-肖像画.git
添加./start.sh/start.sh
添加./foreground.sh/etc/apache2/foreground.sh
添加./supervisord.conf/etc/supervisord.conf
运行chmod 755/start.sh
运行chmod 755/etc/apache2/foreground.sh
暴露80
CMD[“/bin/bash”,“/start.sh”]
我做了一个更暴力的版本来查看,并且
FROM ubuntu
RUN apt-get -yq install ssh
ADD .ssh /root/.ssh/
CMD bash
努力失败-
sven@mini:~/src/docker/tmp$ docker run -rm -t -i test
root@810a2b43ed12:/# 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
root@810a2b43ed12:/# ssh sven@192.168.1.220
Bad owner or permissions on /root/.ssh/config
root@810a2b43ed12:/# chown -R root:root /root/.ssh/
root@810a2b43ed12:/# ssh sven@192.168.1.220
Linux mini 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64
所以我想说你只需要做一个
RUN chown -R root:root /root/.ssh
您应该准备好了。您的
id\u rsa
文件在Dockerfile所在的当前目录中吗?尝试指定它的完整路径你知道在添加id\u rsa/root/.ssh/id\u rsa行之前存在/root/.ssh
目录吗?我真是个白痴,我以为“root”指的是我的计算机的根,而不是Dockerfile。谢谢