Skip to content

forward port from a container to a local port of a machine in a private network

License

Notifications You must be signed in to change notification settings

rimelek/docker-ssh-tunnel-lp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This is an SSH tunnel to forward port from a container to a local port of a machine in a private network. It works only with SSH Keys, so you need to mount your keys into the tunnel container.

Docker Compose Example

version: '2'

services:
  webapp:
    restart: always
    image: my-webapp-image
    ports:
      - 80:80
  tunnel:
    image: rimelek/ssh-tunnel-lp
    network_mode: service:webapp
    volumes:
      - "${HOME}/.ssh:/root/.ssh"
    depends_on:
      - webapp
    environment:
      TUNNEL_HOST: "mytunneluser@my.tunnel.host:12345"
      TUNNEL_REMOTES: |
        mysql.intranet.lan:3306
        nonrootuser@apiserver.intranet.lan:443
        nonrootuser@dockerhost.intranet.lan:2375:2222

Each line of an ssh tunnel has the following format:

[nonrootuser@]hostname:serviceport[:sshport]

About

forward port from a container to a local port of a machine in a private network

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages