No public IP, no port forwarding, no reverse proxy headaches — but you still want to expose your service securely?
That’s exactly where Cloudflare Tunnel (cloudflared) shines ✨
In this post, we’ll quickly walk through a small but powerful Bash script that runs Cloudflare Tunnel using Docker.
🎯 Goal
- 🔒 Keep your server private
- 🌍 Let Cloudflare handle public traffic
- 🐳 Run everything in Docker
- 🎟️ Authenticate using a Tunnel Token
🧾 Bash Script
bash
#!/usr/bin/env bash
set -euo pipefail
CONTAINER="cloudflared"
IMAGE="cloudflare/cloudflared:2025.11.1"
TUNNEL_TOKEN="eyJhIjo..."
docker run -d \
--name "$CONTAINER" \
--restart unless-stopped \
--network app-net \
"$IMAGE" \
tunnel --no-autoupdate run --token "$TUNNEL_TOKEN"
Top comments (0)