【发布时间】:2015-12-07 06:45:37
【问题描述】:
我实际上是在使用带有 phusion/baseimage 的 Docker,我需要通过 ssh 连接。
在 github 存储库 (https://github.com/phusion/baseimage-docker) 的底部写着,要使用我们的自定义公钥,我们必须执行以下操作:
## Install an SSH of your choice.
ADD your_key.pub /tmp/your_key.pub
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
事实是,当我需要添加我的公钥时,如下所示:
ADD /home/thomas/.ssh/id_rsa.pub /tmp/id_rsa.pub
RUN cat /home/thomas/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys && rm -f /home/thomas/.ssh/id_rsa.pub
我在 docker build 中收到此错误。堆栈在我的 shell 命令中:
sudo docker build .
Sending build context to Docker daemon 12.29 kB
Sending build context to Docker daemon
Step 0 : FROM phusion/baseimage:0.9.16
---> 5a14c1498ff4
Step 1 : MAINTAINER Thomas DUPOND <tdupond@gmail.com>
---> Using cache
---> 96e99cf37971
Step 2 : CMD ["/sbin/my_init"]
---> Using cache
---> 4e3c1c0697ac
Step 3 : RUN rm -f /etc/service/sshd/down
---> Using cache
---> 4d856cc02b9d
Step 4 : RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
---> Using cache
---> eab6eb3a6630
Step 5 : ADD /home/thomas/.ssh/id_rsa.pub /tmp/id_rsa.pub
2015/06/29 16:11:13 /home/thomas/.ssh/id_rsa.pub: no such file or directory
我做错了什么?
NB:我的密钥是使用 rsa 从 4096 生成的。它在 /home/thomas/.ssh 目录中,名为 id_rsa.pub
【问题讨论】:
标签: ssh docker dockerfile