Skip to content

homelabshq/tunnelhouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TunnelHouse

TunnelHouse starts a docker container with cloudflared and a dedicated network. So that you can easily manage multiple tunnels on a single host. Just connect your services with the container network and enjoy the uninteruped expose of service to the outside network

Features

  • Easy setup of Cloudflare Tunnel in Docker
  • Automatic Docker network creation
  • Flexible container naming
  • Colorized output for better visibility
  • Comprehensive error checking
  • No container name required (Docker auto-assigns if not specified)

Prerequisites

  • Docker installed and running
  • Cloudflare Tunnel token (set as environment variable)

Installation

  • Recommended installation approach
curl -fsSL https://kanishkk.xyz/tunnelhouse | bash
  • Manual installation: Download the script from this repository and make it executable: Make it executable:
chmod +x tunnelhouse.sh

Usage

Basic Usage

# Set your Cloudflare tunnel token
export TOKEN="your-tunnel-token-here"

# Run with network name (Docker assigns container name automatically)
./tunnelhouse.sh your-network-name

# Run with network and container name
./tunnelhouse.sh your-network-name your-container-name

Using Flags

# Using flags
./tunnelhouse.sh --net your-network-name --name your-container-name

# Short flags
./tunnelhouse.sh -n your-network-name -c your-container-name

Help

./tunnelhouse.sh --help

Environment Variables

  • TOKEN: Required. Your Cloudflare tunnel token.

Examples

  1. Basic setup with auto-assigned container name:

    export TOKEN="your-token-here"
    ./tunnelhouse.sh my-network
  2. With specified container name:

    export TOKEN="your-token-here"
    ./tunnelhouse.sh my-network my-tunnel
  3. Using flags:

    export TOKEN="your-token-here"
    ./tunnelhouse.sh --net my-network --name my-tunnel

Troubleshooting

  1. Docker not found:

    • Ensure Docker is installed and running
    • Verify your user is in the docker group
  2. TOKEN not set:

    • Set the environment variable before running:
      export TOKEN="your-token-here"
  3. Network already exists:

    • The script will use existing networks without issue
    • If you need a fresh network, remove it first:
      docker network rm your-network-name
  4. Container already exists:

    • Use a different container name
    • Or remove the existing container:
      docker rm -f your-container-name

How It Works

  1. Checks Docker installation and daemon status
  2. Verifies the TOKEN environment variable is set
  3. Ensures the specified Docker network exists (creates if needed)
  4. Checks for existing container name conflicts (if specified)
  5. Pulls the latest cloudflared image
  6. Runs the container with the tunnel configuration

License

This project is open source and available under the MIT License.

About

tunnelhouse: A house to your cloudflare tunnel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages