Skip to content

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

License

Notifications You must be signed in to change notification settings

silaskalmbach/Docker_Autossh_Tunnel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published