简体   繁体   中英

docker-compose and ssh volumes

I am starting to use Docker and specifically 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. 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.

For example on Windows 7 you can manage these machines by docker-machine command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM