以下代码段在一个月前运行良好(我上次运行容器时)。今天不行。为什么?
RUN mkdir /root/.ssh && \
mv /root/deployment_key /root/.ssh/id_rsa && cat /root/.ssh/id_rsa && \
chmod 600 /root/.ssh && \
chmod 600 /root/.ssh/id_rsa && \
ssh-keyscan github.com,$(getent hosts github.com | awk '{ print $1 }') > ~/.ssh/known_hosts
当我
cat ~/.ssh/known_hosts
,公钥只有它应该的一半左右。 /root/.ssh/id_rsa
中的私钥是正确的.下一行(私有(private)仓库的
git clone
)失败了Permission denied (publickey).
fatal: The remote end hung up unexpectedly
The command '/bin/sh -c git clone ssh://FOO@github.com/FOO/PRIVAT_REPO.git' returned a non-zero code: 128
我在 OSX 上运行 docker 版本 1.12.1-rc1-beta23(内部版本:11375),但在 Windows 10 上也失败了。
最佳答案
mv /root/deployment_key /root/.ssh/id_rsa
这意味着您的
Dockerfile
包括 ADD
或 COPY
填充 /root/deployment_key
的命令首先,在 RUN mv
之前命令。尝试通过以下方式从现有的 Dockerfile 制作另一个图像:
Dockerfile
为该新图像以 RUN echo /root/deployment_key/id_rsa.pub
看看它是否存在,具有预期的内容和内容长度,RUN mv
部分并检查其内容,然后再继续执行该 RUN 命令的其余部分。 关于git - 损坏的 dockerfile : github deploy key no longer copied correctly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39319410/