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 ?

  • starting container using docker API
  • Issue regarding the Dockerfile creation
  • Running kubernetes autoscalar
  • How to develop a LAMP web application using Docker, Puppet and Vagrant?
  • boot2docker malformed HTTP status code “/v1.15/containers/json”
  • docker boto3 AWS was not able to validate the provided access credentials
  • Mounted docker.sock login not stored
  • Error commiting an image in docker
  • MySQL bind-address in a Docker container
  • container stopped being able to connect database container on same machine
  • How specify the size of a shared Docker volume?
  • Docker swarm run tasks only in workers
  • 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 …
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.