https://github.com/aduermael/docker-tunnel
Connect your local Docker client to remote Docker engine through SSH tunnel.
https://github.com/aduermael/docker-tunnel
client docker remote-docker-engine ssh ssh-tunnel tunnel
Last synced: 6 months ago
JSON representation
Connect your local Docker client to remote Docker engine through SSH tunnel.
- Host: GitHub
- URL: https://github.com/aduermael/docker-tunnel
- Owner: aduermael
- License: mit
- Created: 2016-08-17T23:21:49.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-28T21:52:47.000Z (about 9 years ago)
- Last Synced: 2024-06-20T05:16:26.669Z (almost 2 years ago)
- Topics: client, docker, remote-docker-engine, ssh, ssh-tunnel, tunnel
- Language: Go
- Size: 6.55 MB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-tunnel
Connect to a remote Docker host using an SSH tunnel.

### Requirements:
- Make sure you can connect to your remote Docker host using SSH public key authentication
- OpenSSH 6.7 minimum required at least on the server side.
### How to install:
- **docker-tunnel** can be installed directly on your host like this ([Go](https://golang.org/doc/install) has to be installed):
```bash
$ go install github.com/aduermael/docker-tunnel
```
- You can also get the Docker image:
```bash
$ docker pull aduermael/docker-tunnel
```
### Usage:
**docker-tunnel** has a small command line interface:
```bash
# type this if you installed directly on your host:
$ docker-tunnel
# or this if using the Docker image:
$ docker run --rm aduermael/docker-tunnel
# in both cases, you'll see something like this:
Usage:
docker-tunnel [user@]host [flags]
Flags:
-p, --proxy proxy mode (don't start shell session)
-s, --shell string shell to open session (default "bash")
-i, --sshid string path to private key
```
**docker-tunnel** can be used in 2 different modes:
- **shell mode** (default): opens a shell session, bash by default but a different one can be requested using `-s` flag. From within this shell, all Docker commands are sent to the remote Docker host through an established SSH tunnel.
- **proxy mode** (using `-p` flag): exposes a Docker remote API on port 2375, proxying all requests over SSH to the remote Docker host.
In both modes, the `-i` flag can be used to give the location of your ssh identity file (private key).
### Examples
Run container acting as a Docker remote API proxy to reach remote Docker host.
```bash
$ docker run --rm -v ~/.ssh/id_rsa:/ssh_id -p 127.0.0.1:2375:2375 \
aduermael/docker-tunnel 138.88.888.888 -i /ssh_id -p
# now in a different shell session you can do:
export DOCKER_HOST=tcp://127.0.0.1:2375
# all docker commands will now target the remote side (through the proxy)
```
Open a bash session to run containers on a remote Docker host, using files from your local environment:
```bash
$ docker-tunnel user@138.88.888.888
```