git clone project from inside docker container

I am running few containers of docker, in my development machine. My development machine has got the authorized keys. Is there a possible way to do Git project clone from inside docker container, by leveraging the host ssh keys ?

  • Test VM in GIT repository
  • How to manage code base when developing in a VM (vagrant)
  • using Visual studio on a vm on Mac with Git
  • Git/GitHub connection issue on VM/VirtualBox
  • Segmentation Fault using Git on Virtual Machine
  • Using git “inside” or “outside” virtual machine?
  • PhpStorm + GIT on virtual machine
  • Git Line Endings: Mac to Windows VM
  • 2 Solutions collect form web for “git clone project from inside docker container”

    You can copy your keys to docker container by SCP command or by using shared folder functionality (http://docs.docker.io/en/latest/use/working_with_volumes/)

    If you use an SSH agent, you can also bind-mount the SSH agent socket within the container, e.g.:

    docker run -v $SSH_AUTH_SOCK:/auth.sock -e SSH_AUTH_SOCK=/auth.sock myimage …
    
    Git Baby is a git and github fan, let's start git clone.