Allow to use private keys inside of containers
372
This image provides an SSH agent. This is useful for sharing SSH identities between the host and running containers.
Docker Hub: https://hub.docker.com/r/adclick/ssh-agent/
Just choose a name for the container and start it.
$> docker run -d --name my-ssh-agent adclick/ssh-agent:latest
Locate the private key you want to add, mount it in a volume and connect to the agent.
$> docker run --rm -it --volumes-from my-ssh-agent -v /path/to/my/private/key:/ssh-conf/id_rsa adclick/ssh-agent:latest ssh-add /ssh-conf/id_rsa
Mount the agent's volumes (the socket) and define the SSH_AUTH_SOCK environment variable (with /ssh/socket).
$> docker run --volumes-from my-ssh-agent -e SSH_AUTH_SOCK=/ssh/socket my-fancy-image
Sometimes you'll be running containers with users other than root (to avoid permission issues, for example). As the SSH socket can only be accessed by the user that created it, it is necessary to start the agent with that user. This can be achieved by mapping the agent's default user's UID to match your own.
docker run --volumes-from my-ssh-agent -e SSH_AUTH_SOCK=/ssh/socket -e USER_ID=$(id -u) my-fancy-image
Content type
Image
Digest
Size
4.8 MB
Last updated
about 9 years ago
docker pull adclick/ssh-agent