Docker
Run all commands from the repository root.
Quick start#
git clone https://github.com/VickyDev810/Cloudify-Tunnel-Manager.git
cd Cloudify-Tunnel-Manager
docker compose -f docker/docker-compose.yml up -d --build
Open http://localhost:8765. Create the first account with the setup code from the log:
docker logs cloudify | grep "Setup code"
Click Connect Cloudflare, open the link and pick your domain. Continue with Getting started.
This compose file uses host networking and opens the dashboard on host port 8765: it is the easy setup for development. In a route, localhost is then the Docker host.
Make Docker start at boot: sudo systemctl enable docker.
Production: shared network, no host ports#
Put Cloudify and your app containers on one Docker network, publish no ports, and point each route at container-name:port.
1. Cloudify. In docker/docker-compose.yml, replace network_mode: host with:
ports:
- "127.0.0.1:8765:8765"
networks:
- cloudify
extra_hosts:
- "host.docker.internal:host-gateway"
Add networks: { cloudify: { name: cloudify } } at the end of the file. The ports entry opens the dashboard to this machine only. To publish nothing, leave it out and use docker exec or a dashboard route.
2. Your app. Give it no ports entry. Add networks: [cloudify] to its service, or connect a running container:
docker network connect cloudify your-app
3. The route. Use either one:
- Dashboard: Tunnels → Add route. Service host
your-app, port = the app's port inside its container. - CLI:
docker exec -it cloudify cloudify route add app.example.com 3000 --service your-app -t web
For a service on the Docker host, use the service host host.docker.internal. Background: The idea behind it.
Without Compose#
docker build -f docker/Dockerfile -t cloudify:latest .
docker run -d --name cloudify --restart unless-stopped --network host \
-v cloudify-data:/root/.cloudflared cloudify:latest
Without -v, all data is lost when the container is removed.
Build options#
docker build -f docker/Dockerfile -t cloudify:latest . # pinned cloudflared
docker build -f docker/Dockerfile --build-arg CLOUDFLARED_VERSION=latest -t cloudify:latest . # newest cloudflared
docker buildx build -f docker/Dockerfile --platform linux/amd64,linux/arm64 -t cloudify:latest . # multi-arch
Supported: amd64, arm64, arm (32-bit), 386.
Commands, status and logs#
Run any cloudify command (CLI reference) through docker exec:
docker exec -it cloudify cloudify tunnel list
docker exec -it cloudify cloudify account connect example.com # prints the authorization link
docker exec -it cloudify cloudify route add app.example.com 3000 --service frontend -t web
docker exec -it cloudify cloudify replica import /root/.cloudflared/web-replica.json
docker exec -it cloudify cloudify -ssh host # share the *container's* shell
Copy a file in: docker cp web-replica.json cloudify:/root/.cloudflared/.
docker ps # STATUS shows (healthy)
docker inspect --format '{{.State.Health.Status}}' cloudify
docker logs -f cloudify # dashboard log
docker exec cloudify ls /root/.cloudflared/logs # one log per tunnel
Update#
cd Cloudify-Tunnel-Manager
git pull
docker compose -f docker/docker-compose.yml up -d --build
Data stays in the volume. Clean up with docker image prune.
Move from the 1.x container#
The 1.x container has no data volume. Copy the data out before removing it.
docker rename cloudify cloudify-1x # frees the name "cloudify" for the new container
docker cp cloudify-1x:/root/.cloudflared ./cloudflared-data
docker cp cloudify-1x:/app/users.json ./users.json 2>/dev/null || true
docker stop cloudify-1x
# put the data into the new volume (the shipped compose file names it cloudify_cloudify-data)
docker volume create cloudify_cloudify-data
docker run --rm -v cloudify_cloudify-data:/data -v "$PWD":/src alpine sh -c '
cp -a /src/cloudflared-data/. /data/ &&
if [ -f /src/users.json ]; then mkdir -p /data/cloudify && cp /src/users.json /data/cloudify/users.json &&
chmod 600 /data/cloudify/users.json; fi'
docker compose -f docker/docker-compose.yml up -d --build
- Go back:
docker compose -f docker/docker-compose.yml stop, thendocker start cloudify-1x. - Clean up when everything works:
docker rm cloudify-1xandrm -rf cloudflared-data users.json(the copy contains tunnel secrets).
Backup and restore#
# backup (contains tunnel secrets: store it safely)
docker run --rm -v cloudify_cloudify-data:/data -v "$PWD":/backup alpine \
tar czf /backup/cloudify-backup.tar.gz -C /data .
# restore into a new or empty volume
docker run --rm -v cloudify_cloudify-data:/data -v "$PWD":/backup alpine \
tar xzf /backup/cloudify-backup.tar.gz -C /data
The volume is cloudify_cloudify-data with the compose file and cloudify-data with docker run. Check with docker volume ls.
Secure the dashboard#
By default the dashboard answers on port 8765 over plain HTTP to anyone who can reach it.
Secure mode. Listens on 127.0.0.1 only, answers only to known names:
echo 'CLOUDIFY_SECURE=1' >> docker/.env
docker compose -f docker/docker-compose.yml up -d
With host networking, reach it from your laptop with ssh -L 8765:localhost:8765 user@server. On the shared network, reach it through a route.
Dashboard route with Cloudflare Access.
- On a tunnel, add a route
dash.example.com → localhost:8765. - Protect that hostname with a Cloudflare Access policy (Zero Trust → Access → Applications).
- Turn on secure mode.
HTTPS. Mount a certificate and a key:
environment:
CLOUDIFY_SERVE_ARGS: "--ssl-certfile /certs/cert.pem --ssl-keyfile /certs/key.pem"
volumes:
- cloudify-data:/root/.cloudflared
- ./certs:/certs:ro
Quick tunnel in secure mode. Before docker exec -it cloudify cloudify -p 8765, allow quick tunnel names:
echo 'CLOUDIFY_ALLOWED_HOSTS=*.trycloudflare.com' >> docker/.env
docker compose -f docker/docker-compose.yml up -d
Anyone with the address can open the login page. Stop the quick tunnel when done.
More: Security.
Remove#
docker compose -f docker/docker-compose.yml down # stops and removes the container, keeps the data
docker compose -f docker/docker-compose.yml down -v # ALSO deletes the volume: logins, tunnels, users
Tunnels and DNS records at Cloudflare stay. Delete them first in the dashboard or with docker exec cloudify cloudify tunnel delete <name>.
Platform notes#
- Synology / QNAP / Unraid / TrueNAS: use the compose file in Container Manager / Compose, or
docker runwith a host folder, e.g.-v /volume1/docker/cloudify:/root/.cloudflared. - Raspberry Pi: build on the Pi, or with
buildxforlinux/arm64orlinux/arm/v7(32-bit OS). - Docker Desktop: host networking needs version 4.34 or later with Enable host networking on. Otherwise use the shared network.
- Rootless Docker / Podman: if
localhostroutes fail, use the shared network.