-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 Update documentation in docker-compose.yml file
- Loading branch information
1 parent
3346fd9
commit 9e5e4cf
Showing
1 changed file
with
39 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,48 @@ | ||
# service description | ||
# Docker Compose configuration for setting up a Cloudflare Tunnel container | ||
# | ||
# This configuration pulls the latest Cloudflare Tunnel image from the specified repository | ||
# and includes options for logging, automatic updates using Watchtower, health checks, and volume mounting. | ||
|
||
services: | ||
|
||
# cloudflare tunnel | ||
# Cloudflare Tunnel Service | ||
cloudflare-tunnel: | ||
image: cloudflare/cloudflared:latest | ||
container_name: cloudflare-tunnel | ||
hostname: cloudflare-tunnel | ||
restart: unless-stopped | ||
image: cloudflare/cloudflared:latest # Pull the latest version of the Cloudflare Tunnel image | ||
container_name: cloudflare-tunnel # Name of the Cloudflare Tunnel container | ||
hostname: cloudflare-tunnel # Hostname for the Cloudflare Tunnel container | ||
|
||
restart: unless-stopped # Restart the container unless manually stopped | ||
|
||
# Logging configuration for Cloudflare Tunnel container | ||
logging: | ||
driver: "json-file" | ||
driver: "json-file" # Use the default json-file logging driver | ||
options: | ||
max-size: "100m" | ||
max-file: "10" | ||
network_mode: "host" | ||
command: tunnel run | ||
max-size: "100m" # Maximum log file size before rotation (100 MB) | ||
max-file: "10" # Maximum number of log files to retain (10) | ||
|
||
# Network mode configuration | ||
network_mode: "host" # Use the host network (no isolation between host and container) | ||
|
||
# Command to run Cloudflare Tunnel | ||
command: tunnel run # Command to start the Cloudflare tunnel | ||
|
||
# Volume configuration for time synchronization and hosts file persistence | ||
volumes: | ||
- /etc/localtime:/etc/localtime:ro | ||
- ./config/hosts:/etc/hosts | ||
- /etc/localtime:/etc/localtime:ro # Synchronize time with the host | ||
- ./config/hosts:/etc/hosts # Mount hosts file from host to container | ||
|
||
# Environment variables for Cloudflare Tunnel | ||
environment: | ||
- "TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}" | ||
- "TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}" # Pass the Cloudflare Tunnel token from environment variable | ||
|
||
# Health check configuration to verify Cloudflare Tunnel readiness | ||
healthcheck: | ||
test: ["CMD", "cloudflared", "--version"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 10s | ||
test: ["CMD", "cloudflared", "--version"] # Check if cloudflared version command works | ||
interval: 30s # Time between health check attempts | ||
timeout: 10s # Time to wait for a response | ||
retries: 3 # Number of retries before marking as unhealthy | ||
start_period: 10s # Delay before health checks begin | ||
|
||
# Container labels for additional metadata | ||
labels: | ||
# enable watchtower updates | ||
- "com.centurylinklabs.watchtower.enable=true" | ||
- "com.centurylinklabs.watchtower.enable=true" # Enable automatic updates with Watchtower |