Expose local Docker services via SSH reverse tunnels or Cloudflare Tunnels
1.7K
Expose local Docker services to the internet. Supports SSH reverse tunnels (with auto-reconnect) and Cloudflare Tunnels — in one container.
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.
services:
tunnel:
image: zachbg/tunnel:latest
environment:
TUNNEL_TYPE: cloudflare
LOCAL_HOST: webapp
LOCAL_PORT: 8080
Gives you a random *.trycloudflare.com URL instantly.
services:
tunnel:
image: zachbg/tunnel:latest
environment:
TUNNEL_TYPE: cloudflare
CF_TOKEN: eyJhIjoiMj...
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.
| Variable | Default | Description |
|---|---|---|
TUNNEL_TYPE | ssh | ssh, cloudflare/cf, or local |
LOCAL_HOST | host.docker.internal | Target host to expose |
LOCAL_PORT | required | Target port to expose |
| Variable | Default | Description |
|---|---|---|
SSH_HOST | required | Remote SSH server |
SSH_USER | root | SSH username |
SSH_PORT | 22 | SSH port |
SSH_KEY | /key/id_rsa | Path to SSH private key |
REMOTE_PORT | 0 | Port on remote server (0 = random) |
AUTOSSH | true | Auto-reconnect on disconnect |
| Variable | Default | Description |
|---|---|---|
CF_TOKEN | Cloudflare tunnel token (named tunnel) | |
CF_HOSTNAME | Custom hostname |
Content type
Image
Digest
sha256:5c9ae1e9f…
Size
8 MB
Last updated
6 months ago
docker pull zachbg/tunnel