How to Self-Host a Dockerized App on WSL2 Using a Cloudflare Tunnel

A developer built a proof-of-concept to-do app using Node.js, Express, and Postgres running inside Docker on WSL2, made publicly accessible via a named Cloudflare tunnel on a custom domain. The app uses a per-browser cookie hash instead of a login system, and automatically clears its database every two hours. Two deployment approaches were tested: a bare Dockerfile connecting to a Windows-hosted Postgres instance, and a docker-compose setup with its own Postgres and a crond sidecar for scheduled cleanup. The project revealed that using raw Docker Engine inside WSL2, rather than Docker Desktop, broke host networking assumptions and required rethinking the architecture. The write-up shares practical lessons on WSL2 Docker setup, pg_cron limitations on Windows, and idiomatic container patterns for periodic tasks.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in