Sign inSign up

zachbg/tunnel

By zachbg

•Updated 6 months ago

Expose local Docker services via SSH reverse tunnels or Cloudflare Tunnels

Image
1

1.7K

zachbg/tunnel repository overview

⁠Tunnel

Expose local Docker services to the internet. Supports SSH reverse tunnels (with auto-reconnect) and Cloudflare Tunnels — in one container.

⁠Why?

You need to show a client your local dev setup. Your home server is behind NAT. Your webhook endpoint needs to be publicly reachable. You don't want to configure port forwarding on your router or buy a static IP.

⁠Quick Start

⁠Cloudflare Quick Tunnel (instant, no account needed)
services:
  tunnel:
    image: zachbg/tunnel:latest
    environment:
      TUNNEL_TYPE: cloudflare
      LOCAL_HOST: webapp
      LOCAL_PORT: 8080

Gives you a random *.trycloudflare.com URL instantly.

⁠Cloudflare Named Tunnel (permanent, custom domain)
services:
  tunnel:
    image: zachbg/tunnel:latest
    environment:
      TUNNEL_TYPE: cloudflare
      CF_TOKEN: eyJhIjoiMj...
⁠SSH Reverse Tunnel
services:
  tunnel:
    image: zachbg/tunnel:latest
    volumes:
      - ~/.ssh/id_rsa:/key/id_rsa:ro
    environment:
      TUNNEL_TYPE: ssh
      SSH_HOST: myserver.com
      SSH_USER: root
      LOCAL_HOST: webapp
      LOCAL_PORT: 8080
      REMOTE_PORT: 9090

Your app is now accessible at myserver.com:9090.

⁠Environment Variables

⁠Common
VariableDefaultDescription
TUNNEL_TYPEsshssh, cloudflare/cf, or local
LOCAL_HOSThost.docker.internalTarget host to expose
LOCAL_PORTrequiredTarget port to expose
⁠SSH Tunnels
VariableDefaultDescription
SSH_HOSTrequiredRemote SSH server
SSH_USERrootSSH username
SSH_PORT22SSH port
SSH_KEY/key/id_rsaPath to SSH private key
REMOTE_PORT0Port on remote server (0 = random)
AUTOSSHtrueAuto-reconnect on disconnect
⁠Cloudflare Tunnels
VariableDefaultDescription
CF_TOKENCloudflare tunnel token (named tunnel)
CF_HOSTNAMECustom hostname

⁠Use Cases

  • Webhook development: Expose local API to receive GitHub/Stripe webhooks
  • Client demos: Share your local dev environment instantly
  • Home server: Expose services behind NAT without opening router ports
  • CI/CD callbacks: Allow external services to reach your build server

Tag summary

Content type

Image

Digest

sha256:5c9ae1e9f…

Size

8 MB

Last updated

6 months ago

docker pull zachbg/tunnel