You might want to ssh into a docker container and pull some remote repository which requires the SSH keys stored on the host machine. Edit your docker-compose file as follows:
- Set the environment variable
SSH_AUTH_SOCK
to the socket being used by the agent. - Mount that agent in the container.
services:
app:
environment:
- SSH_AUTH_SOCK=/ssh-agent
volumes:
- ${SSH_AUTH_SOCK}:/ssh-agent