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 ?

  • Automated pulling from gitolite repo within docker container
  • docker-compose, export environnement variables are not working in Jenkins
  • Docker install PHP-7-fpm with Memcache extention ? fails with Cannot find config.m4
  • How would I mount docker container filesystem?
  • Creating proper build or deployment chain with Microservices, Docker, Jenkins and GIT
  • Updating docker images with small changes using commits
  • GitLab: You are not allowed to access master! After moving gitlab to another server
  • Use ppk key when cloning a git repo
  • Stage file by its file name, regardless of directory--Git
  • How do I untrack CVS folders after using git-cvsimport?
  • How can i use git pull --rebase in git GUI
  • automatically select sha's to edit during git rebase
  • 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.