[英]docker-compose and ssh volumes
I am starting to use Docker and specifically docker-compose
. 我开始使用Docker,特别是
docker-compose
。 When building the container and it's services I would like to be able to use the hosts SSH keys so that I can pull from some private repo's. 构建容器及其服务时,我希望能够使用主机SSH密钥,以便可以从某些私有存储库中提取信息。 I am trying to add a volume like below but this does not seem to be working
我正在尝试添加如下所示的卷,但这似乎不起作用
version: "2.0"
services:
my-service:
build:
context: .
args:
arg_1: arg1
arg_2: arg2
volumes:
- ~/.ssh:/root/.ssh
When cloning a repo i get the error 克隆仓库时出现错误
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
And when logging into the container the keys are not there. 当登录到容器时,密钥不存在。 Am i approaching this incorrectly ?
我的处理方式不正确吗?
Thanks 谢谢
Which operating system do you use? 您使用哪个操作系统? Be aware that on some systems there is additional virtualization layer and the path ~/.ssh can refer to that virtual machine.
请注意,在某些系统上,还有附加的虚拟化层,〜/ .ssh路径可以引用该虚拟机。
For example on Windows 7 you can manage these machines by docker-machine command. 例如,在Windows 7上,您可以通过docker-machine命令管理这些机器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.