在构建过程中,我试图向ssh代理(docker映像)添加一个本地私钥。
Problem我运行了eval$(ssh-agent -s),一旦ssh-add /etc/ssh/id_rsa运行,就会收到以下错误:
Could not open a connection to your authentication agent.
目标:在NPM安装过程中,我需要克隆一个私有的git。这个本地密钥将允许我对私人回购进行身份验证。
====输出片段====
Step 8/16 : RUN eval $(ssh-agent -s)
---> Running in 195ffeb1f84f
Agent pid 8
---> 0fcbc89d362f
Removing intermediate container 195ffeb1f84f
Step 9/16 : RUN ssh-add /etc/ssh/id_rsa
---> Running in ae99039e1fba
Could not open a connection to your authentication agent.
The command '/bin/sh -c ssh-add /etc/ssh/id_rsa' returned a non-zero code: 2发布于 2018-02-20 02:12:33
在步骤8中运行的代理在第9步时已经死亡。您需要或执行所有步骤,然后才能工作。
RUN eval $(ssh-agent -s) && ssh-add /etc/ssh/id_rsa && git checkout .....发布于 2018-02-19 20:13:13
你为什么不在容器里用音量呢?
您可以使用/etc/ssh/id_rsa路径在容器卷中挂载/root/.ssh/id_rsa。
https://stackoverflow.com/questions/48872308
复制相似问题