Skip to content

Commit 9e5e4cf

Browse files
committed
📝 Update documentation in docker-compose.yml file
1 parent 3346fd9 commit 9e5e4cf

File tree

1 file changed

+39
-21
lines changed

1 file changed

+39
-21
lines changed

docker-compose.yml

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,48 @@
1-
# service description
1+
# Docker Compose configuration for setting up a Cloudflare Tunnel container
2+
#
3+
# This configuration pulls the latest Cloudflare Tunnel image from the specified repository
4+
# and includes options for logging, automatic updates using Watchtower, health checks, and volume mounting.
5+
26
services:
37

4-
# cloudflare tunnel
8+
# Cloudflare Tunnel Service
59
cloudflare-tunnel:
6-
image: cloudflare/cloudflared:latest
7-
container_name: cloudflare-tunnel
8-
hostname: cloudflare-tunnel
9-
restart: unless-stopped
10+
image: cloudflare/cloudflared:latest # Pull the latest version of the Cloudflare Tunnel image
11+
container_name: cloudflare-tunnel # Name of the Cloudflare Tunnel container
12+
hostname: cloudflare-tunnel # Hostname for the Cloudflare Tunnel container
13+
14+
restart: unless-stopped # Restart the container unless manually stopped
15+
16+
# Logging configuration for Cloudflare Tunnel container
1017
logging:
11-
driver: "json-file"
18+
driver: "json-file" # Use the default json-file logging driver
1219
options:
13-
max-size: "100m"
14-
max-file: "10"
15-
network_mode: "host"
16-
command: tunnel run
20+
max-size: "100m" # Maximum log file size before rotation (100 MB)
21+
max-file: "10" # Maximum number of log files to retain (10)
22+
23+
# Network mode configuration
24+
network_mode: "host" # Use the host network (no isolation between host and container)
25+
26+
# Command to run Cloudflare Tunnel
27+
command: tunnel run # Command to start the Cloudflare tunnel
28+
29+
# Volume configuration for time synchronization and hosts file persistence
1730
volumes:
18-
- /etc/localtime:/etc/localtime:ro
19-
- ./config/hosts:/etc/hosts
31+
- /etc/localtime:/etc/localtime:ro # Synchronize time with the host
32+
- ./config/hosts:/etc/hosts # Mount hosts file from host to container
33+
34+
# Environment variables for Cloudflare Tunnel
2035
environment:
21-
- "TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}"
36+
- "TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}" # Pass the Cloudflare Tunnel token from environment variable
37+
38+
# Health check configuration to verify Cloudflare Tunnel readiness
2239
healthcheck:
23-
test: ["CMD", "cloudflared", "--version"]
24-
interval: 30s
25-
timeout: 10s
26-
retries: 3
27-
start_period: 10s
40+
test: ["CMD", "cloudflared", "--version"] # Check if cloudflared version command works
41+
interval: 30s # Time between health check attempts
42+
timeout: 10s # Time to wait for a response
43+
retries: 3 # Number of retries before marking as unhealthy
44+
start_period: 10s # Delay before health checks begin
45+
46+
# Container labels for additional metadata
2847
labels:
29-
# enable watchtower updates
30-
- "com.centurylinklabs.watchtower.enable=true"
48+
- "com.centurylinklabs.watchtower.enable=true" # Enable automatic updates with Watchtower

0 commit comments

Comments
 (0)