Code Monkey home page Code Monkey logo

docker-tunnel's Introduction

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 has to be installed):

     $ go install github.com/aduermael/docker-tunnel
  • You can also get the Docker image:

     $ docker pull aduermael/docker-tunnel

Usage:

docker-tunnel has a small command line interface:

# 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.

$ 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:

$ docker-tunnel [email protected]

docker-tunnel's People

Contributors

aduermael avatar gdevillele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

docker-tunnel's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.