In fact, you do not need to copy your secret key into your container (and you better not do this).
, , ssh-agent : , , , - ssh-aget:
docker-compose:
environment:
- "SSH_AUTH_SOCK=/tmp/ssh-agent"
volumes:
- $SSH_AUTH_SOCK:/tmp/ssh-agent
:
docker run -v $SSH_AUTH_SOCK:/tmp/ssh-agent -e SSH_AUTH_SOCK=/tmp/ssh-agent
P.S
, , export, evaled ssh-agent.
: SSH_AUTH_SOCK SSH_AGENT_PID. export .
RUN : ssh-agent , . Dockerfile ( ).
(, ), RUN:
RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa