Use SSH Agent Forwarding in Docker
version: "3.7"
services:
app:
build:
context: .
environment:
- SSH_AUTH_SOCK=/tmp/ssh-agent.sock
volumes:
- .:/usr/src/app
- "$SSH_AUTH_SOCK:/tmp/ssh-agent.sock"
Read other posts