A Docker Compose stack for running Foundry Virtual Tabletop with Cloudflare Tunnel for secure external access without port forwarding.
- 🎲 Foundry VTT - Pinned to version 13.348.0
- 🔒 Cloudflare Tunnel - Secure access without opening ports
- 📦 Docker Compose - Easy deployment and management
- ⚙️ Environment-based config - All settings via
.envfile - 🔄 Persistent data - Foundry data stored in
./datavolume
- Docker and Docker Compose
- Cloudflare account (free tier works)
- Foundry VTT license
git clone https://github.com/zdaar/foundryvtt-cloudflared-docker.git
cd foundryvtt-cloudflared-docker
cp .env.example .envEdit .env and set required variables:
# Required
FOUNDRY_USERNAME=your_foundryvtt_username
FOUNDRY_PASSWORD=your_foundryvtt_password
FOUNDRY_ADMIN_KEY=your_admin_password
FOUNDRY_LICENSE_KEY=AAAA-BBBB-CCCC-DDDD-EEEE-FFFF
TUNNEL_TOKEN=your_cloudflare_tunnel_token
# Optional (defaults provided)
FOUNDRY_HOSTNAME=foundry.example.com
TZ=UTC- Go to Cloudflare Zero Trust Dashboard
- Navigate to Networks → Tunnels
- Click Create a tunnel
- Choose Cloudflared connector
- Name your tunnel (e.g., "foundryvtt")
- Select Docker and copy the token from the command
- Paste the token into your
.envfile asTUNNEL_TOKEN
In the Cloudflare Tunnel dashboard:
- Go to Public Hostname tab
- Click Add a public hostname
- Configure:
- Subdomain:
foundry(or your choice) - Domain: Select your domain
- Service Type:
HTTP - URL:
foundryvtt:30000
- Subdomain:
- Save
docker compose up -dVisit your configured hostname (e.g., https://foundry.example.com)
See .env.example for all available options. Key variables:
| Variable | Description | Default |
|---|---|---|
FOUNDRY_USERNAME |
FoundryVTT account username | required |
FOUNDRY_PASSWORD |
FoundryVTT account password | required |
FOUNDRY_ADMIN_KEY |
Admin access password | required |
FOUNDRY_LICENSE_KEY |
License key (optional if using account auth) | - |
FOUNDRY_HOSTNAME |
Public hostname for invitation links | - |
FOUNDRY_COMPRESS_WEBSOCKET |
Enable websocket compression | true |
FOUNDRY_MINIFY_STATIC_FILES |
Minify JS/CSS files | true |
FOUNDRY_TELEMETRY |
Enable Foundry telemetry | false |
TUNNEL_TOKEN |
Cloudflare tunnel token | required |
TZ |
Timezone (TZ database name) | UTC |
For complete list of options, see the felddy/foundryvtt documentation.
If you own the domain but the tunnel is in a different Cloudflare account:
- Create a CNAME record in your DNS:
foundry.yourdomain.com CNAME <tunnel-id>.cfargotunnel.com - The tunnel ID can be found in the tunnel dashboard or container logs
- Configure the public hostname route in the tunnel dashboard
Foundry data is stored in ./data directory. This includes:
- Worlds
- Systems
- Modules
- User uploads
Back up this directory regularly!
Edit compose.yml and change the image tag:
foundryvtt:
image: felddy/foundryvtt:release-13.348.0 # Change version hereThen:
docker compose pull
docker compose up -dEdit compose.yml and change the cloudflared image tag, then pull and restart:
docker compose pull cloudflared
docker compose up -d cloudflared# All services
docker compose logs -f
# Foundry only
docker compose logs -f foundryvtt
# Cloudflare Tunnel only
docker compose logs -f cloudflared- Verify
TUNNEL_TOKENis correct - Check tunnel status in Cloudflare dashboard
- Ensure Docker container has internet access
- Verify
FOUNDRY_USERNAMEandFOUNDRY_PASSWORDare correct - Check if license is valid and not already in use
- Review logs for authentication errors
- Verify public hostname is configured in tunnel dashboard
- Check DNS propagation (if using CNAME)
- Ensure service URL is
foundryvtt:30000(notlocalhost)
- Never commit
.envfile to git (already in.gitignore) - Use strong passwords for
FOUNDRY_ADMIN_KEY - Cloudflare Tunnel provides automatic HTTPS encryption
- No ports need to be exposed on your host machine
This repository contains configuration files only. See respective projects for licensing:
- Foundry VTT - Proprietary (license required)
- felddy/foundryvtt-docker - CC0 1.0
- Cloudflare Tunnel - Apache 2.0
- Foundry Gaming LLC - Foundry Virtual Tabletop
- felddy - Docker image for Foundry VTT
- Cloudflare - Cloudflare Tunnel
Issues and pull requests welcome!