Skip to content

Instantly share code, notes, and snippets.

@djmaze
Last active November 23, 2022 16:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djmaze/8c3855ebca9f84cc9696e410e6b314bf to your computer and use it in GitHub Desktop.
Save djmaze/8c3855ebca9f84cc9696e410e6b314bf to your computer and use it in GitHub Desktop.
Use docker-ssh-agent-forward with Docker Compose
version: '3'
services:
app:
image: gcea/ssh-client
environment:
SSH_AUTH_SOCK: /ssh-agent/ssh-agent.sock
volumes:
- ssh-agent:/ssh-agent
volumes:
ssh-agent:
external: true
$ pinata-ssh-forward
ssh-agent
Agent forwarding successfully started.
Run "pinata-ssh-mount" to get a command-line fragment that
can be added to "docker run" to mount the SSH agent socket.
For example:
docker run -it `pinata-ssh-mount` ocaml/opam ssh git@github.com
$ docker-compose run --rm app ssh -o StrictHostKeyChecking=no git@github.com
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi djmaze! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment