https://github.com/docksal/service-ssh-agent
SSH agent service image for Docksal
https://github.com/docksal/service-ssh-agent
Last synced: over 1 year ago
JSON representation
SSH agent service image for Docksal
- Host: GitHub
- URL: https://github.com/docksal/service-ssh-agent
- Owner: docksal
- License: mit
- Created: 2016-09-27T16:24:55.000Z (almost 10 years ago)
- Default Branch: develop
- Last Pushed: 2022-03-06T21:48:22.000Z (over 4 years ago)
- Last Synced: 2024-05-22T19:17:01.692Z (about 2 years ago)
- Language: Shell
- Homepage: http://docksal.io
- Size: 46.9 KB
- Stars: 9
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SSH Agent Docker image for Docksal
This image(s) is part of the [Docksal](http://docksal.io) image library.
The exposed ssh-agent socket will be accessible to all users (not only root) in any container.
This is achieved by exposing a proxy socket (`/.ssh-agent/proxy-socket`) via socat.
## Usage
### 1. Start the ssh-agent container
```bash
docker run -d --name=ssh-agent docksal/ssh-agent
```
### 2. Add your ssh keys
Replace `~/.ssh` with the path to your keys and `id_rsa` with the key name.
If the key has a passphrase, you will be asked to enter it.
```bash
docker run --rm --volumes-from=ssh-agent -v ~/.ssh:/root/.ssh -it ssh-agent ssh-add /root/.ssh/id_rsa
```
### 3. Access SSH keys from the ssh-agent in other containers
Mount the ssh-agent socket and set the `SSH_AUTH_SOCK` variable in other containers.
Docker
```bash
docker run --rm --volumes-from=ssh-agent -e SSH_AUTH_SOCK=/.ssh-agent/proxy-socket-it ssh-add -l
```
Docker Compose
```yaml
...
volumes_from:
- ssh-agent
...
environment:
- SSH_AUTH_SOCK /.ssh-agent/proxy-socket
...
```
### Deleting all keys from the ssh-agent
```bash
docker run --rm --volumes-from=ssh-agent -it docksal/ssh-agent ssh-add -D
```
### Running in TCP proxy mode
This image supports creating a Unix socket that connects to a remote TCP socket, e.g. when connecting
to a remote machine that exposes a Unix socket as a TCP endpoint.
```bash
docker run -d --name=ssh-agent docksal/ssh-agent ssh-proxy {host/IP} {TCP port}
```