Skip to main content

docker-tunnel is a console utility to use remote docker with SSH tunnel.

If you are using OS X or a Linux distribution with docker-unsupported kernel, no more running a virtual machine or ssh to a remote shell.

Installation

With pip:

$ pip install docker-tunnel

With pipsi (Recommended):

$ pipsi install docker-tunnel

Usage

$ docker-tunnel user@example.com
(user@example.com) $
(user@example.com) $ echo $DOCKER_HOST
127.0.0.1:4243
(user@example.com) $ docker ps  # go ahead
...
(user@example.com) $ ^D  # ctrl-d
$

More options:

$ docker-tunnel --help

Shell Theme Integration

Inside the tunnel injected shell, the environment variable DOCKER_HOST and DOCKER_PROMPT_INFO will be assigned. They can be used in your shell theme to prompt you which tunnel is using.

There is an example, my custom theme for OH-MY-ZSH.

Troubleshooting

Error response from daemon: client and server don't have same version (client : 1.14, server: 1.12)

The docker in source of CentOS 7 is using API 1.12 but the docker client in Homebrew of OS X is not. You can downgrade the docker client with Homebrew:

$ brew versions docker
...
1.0.0    git checkout c513c42 /usr/local/Library/Formula/docker.rb
...
$ cd /usr/local/Library/Formula  # now we install the old version of docker
$ git checkout c513c42 -- docker.rb
$ brew unlink docker
$ brew install docker
$ git checkout HEAD -- docker.rb
$ cd -
$ brew info docker  # check the installed versions and current version
...
/usr/local/Cellar/docker/1.1.1 (9 files, 9.8M) *
  Poured from bottle
/usr/local/Cellar/docker/1.2.0 (9 files, 6.6M)
  Poured from bottle
...
$ docker-tunnel user@example.com
(user@example.com) $ docker version
Client version: 1.0.0
Client API version: 1.12
...
(user@example.com) $ exit
$ brew switch 1.2.0  # restore to latest
bind: Address already in use. cannot listen to port: 4243

You can find out the process which held the 4243 port with sudo lsof -i :4243 and decide to kill it or pick another port with --local-port.

channel 1: open failed: connect failed: Connection refused. 2014/09/06 13:08:57 Get http://127.0.0.1:4243/v1.14/info: EOF

Does the docker server listen on 127.0.0.1:2375? You may have to set correct server info with --remote-host and --remote-port.

Known Bugs

  • The ssh tunnel can be authenticated with public key only. The password prompt will caused a crash.

Issues

If you want to report bugs or request features, please create issues on GitHub Issues.

Metadata

Release files for docker-tunnel 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docker-tunnel 0.1.2
File Size Uploaded Provenance
docker-tunnel-0.1.2.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for docker-tunnel 0.1.2
File Interpreter ABI Platform
docker_tunnel-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.6 kB

Release files / docker-tunnel-0.1.2.tar.gz

Download URL docker-tunnel-0.1.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ef4a3c61ff83aed3962ab24379291b52b6fb389cc0126027efeafaf1c6ead7ec
BLAKE2b-256 checksum
How to use checksums
d5cdd34d87d14f65ddb97e52caa252abfcf7dc293a2518f6f32fc00752aa346f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / docker_tunnel-0.1.2-py2.py3-none-any.whl

Download URL docker_tunnel-0.1.2-py2.py3-none-any.whl
Size 6.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8241a5833c176f4a1de6aadf74d3e2b42bb2bc82f0cb6c6885d60720d9f0d4ac
BLAKE2b-256 checksum
How to use checksums
f1e6c5a41cdd3eb3b8f8b60a9096b891c670c9b6042e4323ac8a70627caf715b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for docker-tunnel 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page