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: bridge
container_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.env
to.env
file in the same directory as thedocker-compose.yml
file. - Edit the
.env
file and set theCLOUDFLARED_TOKEN
variable to your Cloudflare Tunnel token. - Run
docker-compose up -d
to 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.