silaskalmbach / Docker_Autossh_Tunnel

Minimal Dockerfile to pass any number of ports with autossh through an ssh tunnel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flexible Autossh Tunnel (Docker)

Minimal Dockerfile to pass any number of ports with autossh through an ssh tunnel. The Dockerfile is designed to allow ssh-keygen to be included without linking them in a separate volume. Well suited to include them in IoT services like Balena.

To do this, add your ssh key to the folder "ssh_key" and specify it's name in docker-compose. If you don't want to use an ssh key, just remove the part "-i /ssh_key/${KEYNAME}"\ from the tunnel.sh file.

Docker-Compose example, as it can also be found in the repository:

version: '2.1'

services:
  tunnel:
    build: 
      context: .
      dockerfile: Dockerfile
    restart: unless-stopped
    ports:
      - 3001:3001 #Ports not necessary for an reverse ssh tunnel
    environment:
      - TUNNEL=-R 0.0.0.0:3000:localhost:80 -L 3001:localhost:1880 #as many tunnels as you like
      - SSH_USER=ubuntu
      - KEYNAME=example.key
      - SSH_PORT=22 #22 [Default]

© Silas Kalmbach

About

Minimal Dockerfile to pass any number of ports with autossh through an ssh tunnel

License:MIT License


Languages

Language:Shell 63.8%Language:Dockerfile 36.2%