I made a small repo for quickly running n8n locally with Docker and exposing it through a Cloudflare Tunnel:
https://github.com/akshaynexus/n8n-docker-cloudflared
The goal is to make a useful local n8n setup with very little config. It includes n8n, Postgres, persistent Docker volumes, Cloudflared, local file access through a mounted ./files directory, and a custom n8n image with common npm packages already installed for Code nodes.
It supports two ways to use it.
Option 1: automatic setup script
Clone the repo, create your .env, then run:
cp .env.example .env
./scripts/start.sh
The script starts a Cloudflare quick tunnel, extracts the generated trycloudflare.com URL, updates .env, and starts n8n with the correct webhook settings.
It prints both:
http://localhost:5678/
https://xxxx.trycloudflare.com/
This is the easiest path if you just want n8n running with webhooks working quickly.
Option 2: manual setup
You can also start everything manually:
cp .env.example .env
docker compose up -d --build
docker compose logs -f cloudflared
Cloudflared will print a URL like:
https://xxxx.trycloudflare.com
Then update .env:
N8N_HOST=xxxx.trycloudflare.com
N8N_PROTOCOL=https
WEBHOOK_URL=https://xxxx.trycloudflare.com/
Restart the stack:
docker compose up -d
Then open n8n using either the Cloudflare URL or:
http://localhost:5678/
The setup also mounts a local files/ folder into n8n as /files, so workflows can read and write files there. It also preinstalls useful Code node libraries like axios, lodash, zod, moment, dayjs, and uuid.
Quick tunnels are mainly for local testing and webhook development. For long-running usage, the repo also includes notes for switching to a named Cloudflare Tunnel with your own domain.