docker-compose和ssh卷

我开始使用Docker,特别是docker-compose 。 当build立容器和它的服务,我希望能够使用主机SSH密钥,以便我可以从一些私人回购拉。 我试图添加一个像下面的音量,但这似乎并没有工作

 version: "2.0" services: my-service: build: context: . args: arg_1: arg1 arg_2: arg2 volumes: - ~/.ssh:/root/.ssh 

当克隆回购时,我得到错误

 ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory 

login容器时,钥匙不在那里。 我不正确地接近吗?

谢谢

你使用哪个操作系统? 请注意,在某些系统上还有额外的虚拟化层,path〜/ .ssh可以引用该虚拟机。

例如,在Windows 7上,您可以通过docker-machine命令pipe理这些机器。