This Docker Compose setup runs a cloudflared tunnel in a Docker container using the cloudflare/cloudflared:latest image.
The docker-compose.yml file is configured as follows:
version: '3.7'
services:
cloudflared:
container_name: cloudflared-tunnel
image: cloudflare/cloudflared:latest
command: tunnel --no-autoupdate run --protocol quic --token ${CLOUDFLARED_TOKEN}
volumes:
- /etc/localtime:/etc/localtime:ro
networks:
- racksync
#environment:
# TZ: "Asia/Bangkok"
restart: always
networks:
racksync:
driver: bridgecontainer_name: Specifies the name of the container.image: The Docker image used to create the container.command: The command executed when the container starts.volumes: Binds the host's timezone data to the container.networks: Specifies the network that the container connects to.restart: Determines the restart policy.
git clone https://github.com/smilexth/cloudflared-tunnel-docker
cd cloudflared-tunnel-docker- Move
default.envto.envfile in the same directory as thedocker-compose.ymlfile. - Edit the
.envfile and set theCLOUDFLARED_TOKENvariable to your Cloudflare Tunnel token. - Run
docker-compose up -dto start the container.
To view the logs, run docker-compose logs -f.
- For issues, please open an issue or seek support in relevant forums.
- Contributions are welcome! Create a pull request to contribute.