A sample Docker Compose file and brief guide for Cloudflare Zero Trust Tunnels.
-
Clone the repository:
git clone https://github.com/mwdle/CloudflareTunnelConfig.git
-
Create a file called
.env
in the same directory asdocker-compose.yml
containing the following property:TUNNEL_TOKEN=<YOUR_CLOUDFLARE_TUNNEL_TOKEN>
-
Open a terminal in the directory containing the docker-compose file.
-
Create a docker network for the container:
docker network create CloudflareTunnel
-
Start the container:
docker compose up -d
-
Attach other containers to the CloudflareTunnel network you created earlier by executing the following:
docker network connect CloudflareTunnel <CONTAINER_NAME>
-
Configure a tunnel with a service URL that is the name of the container you want to tunnel:
-
If using a reverse proxy, simply use the name of your reverse proxy container, add the Origin Server Name, HTTP Host Header and HTTP/2 like in the following example:
Your container should be up and running and your tunnels should be accessible according to your configuration. Attach your reverse proxy container to the previously created Docker Network and configure it accordingly.
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.
This repository is provided as-is and is intended for informational and reference purposes only. The author assumes no responsibility for any errors or omissions in the content or for any consequences that may arise from the use of the information provided. Always exercise caution and seek professional advice if necessary.