Self-Hosting a Dockerized App on WSL2, Exposed with a Cloudflare Tunnel
DEV Community

Self-Hosting a Dockerized App on WSL2, Exposed with a Cloudflare Tunnel

TL;DR: A proof-of-concept to-do app - Node/Express and Postgres, running in Docker on WSL2 - reachable at a real domain through a named cloudflared tunnel. No login system, just a per-browser cookie hash. If you already have WSL2 and a Cloudflare-managed domain, expect this to take a few minutes, not hours.

I wanted a small proof of concept: a to-do list with real persistence, running in Docker, reachable from my own domain instead of localhost. Nothing about that sounded hard on paper to me, but I knew I was a bit rusty on it. So, brushing off the dust, I encountered three lessons I'm sharing here with you... besides the fact I don't want to be paying for small hosting for small PoCs lol.

What You'll Need

  • Windows OS
  • WSL2 with an Ubuntu distro
  • Docker Engine installed inside WSL2 (not Docker Desktop - more on why below)
  • cloudflared (I used v2026.9.1)
  • A domain managed in Cloudflare, so you can route a subdomain to a tunnel

What We're Building

The app itself is deliberately small: Node.js and Express on node:alpine, one Postgres table (todos), and no real authentication. Each visitor gets an httpOnly cookie with a random hash (crypto.randomBytes(16).toString('hex')), and every query filters by that hash. That gives you a separate list per browser without a login screen - fine for a POC

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.