Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 200
mashf13 Avatar asked Oct 29 '25 19:10

mashf13


2 Answers

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 …
like image 134
jpetazzo Avatar answered Nov 01 '25 10:11

jpetazzo


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/)

like image 40
ceth Avatar answered Nov 01 '25 10:11

ceth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!