Sign inSign up

vkandy/sshd

By vkandy

•Updated over 9 years ago

openssh server container to create an ssh-tunnel to remote Docker overlay networks

Image
0

2.2K

vkandy/sshd repository overview

⁠sshd

Tiny openssh server container that can be used to establish an ssh-tunnel to a remote docker environment (or an overlay network) without having to expose container ports.

⁠Usage

Create a ssh key pair and start the sshd container with the public key (pass the key as AUTHORIZED_KEY environment variable).

You can now login to this sshd container using your private key. Or create a tunnel to the remote docker swarm network.

Example usage in docker-compose file:

version: "3"

services:
  sshd:
    image: vkandy/sshd
    ports:
      - 2222:22
    networks:
      - my-network
    environment:
      - AUTHORIZED_KEY=ssh-rsa AAAA

Example usage as a standalone container:

docker run -it -e AUTHORIZED_KEY="ssh-rsa AAAA" -p 2222:22 vkandy/sshd

⁠ssh-tunnel

Suppose you have container:8080 running on a remote host remotedockerhost, to access the container port locally, create a tunnel like so:

ssh -i ~/.ssh/private_key -p 2222 user@remotedockerhost -fNL 9090:container:8080

E.g., to access RethinkDB admin interface, create a tunnel to RethinkDB container:

ssh -i ~/.ssh/private_key -p 2222 user@remotedockerhost -fNL 9090:rethinkdb:8080

You can now access RethinkDB admin interface at http://localhost:9090⁠

Kill the tunnel like so: kill $(lsof -t -i @localhost:9090 -sTCP:listen)

Tag summary

Content type

Image

Digest

Size

4.2 MB

Last updated

over 9 years ago

docker pull vkandy/sshd