Cloudflare Tunnel docker-compose.yml

Cloudflare使用docker compose部署方式时,特别是在aliyun服务器上进行部署时,需要注意docker pull拉取时的版本,版本较老时,可能会遇到tunnel command参数问题:

WARN0001 The "TUNNEL_TOKEN" variable is not set. Defaulting to a blank string.

导致docker一直重启(设置了restart规则时)。此时token为设置成功,Cloudflare无法捕获tunnel。

遇到这种情况时可以使用指定版本来解决:

XML 复制代码
services:
  cloudflared:
    image: cloudflare/cloudflared:1871-81a53555aa82
    container_name: cloudflared
    restart: unless-stopped
    # Logging configuration for Cloudflare Tunnel container
    logging:
      driver: "json-file"                             # Use the default json-file logging driver
      options:
        max-size: "100m"                              # Maximum log file size before rotation (100 MB)
        max-file: "5"                                # Maximum number of log files to retain (10)
    command: tunnel --no-autoupdate run              # Command to start the Cloudflare tunnel
    # Volume configuration for time synchronization and hosts file persistence
    volumes:
      - /etc/localtime:/etc/localtime:ro              # Synchronize time with the host
    # Environment variables for Cloudflare Tunnel
    environment:
      - TUNNEL_TOKEN=${TUNNEL_TOKEN}

在docker-compose.yml同级文件夹下新建.env文件,内容为:

bash 复制代码
# 不要加引号
TUNNEL_TOKEN=Your Token

这样就可以顺利启动docker,然后在cloudflare网站中继续设置tunnel相关配置。

相关推荐
小白的码BUG之路25 分钟前
Docker -- No space left on device
运维·docker·容器
程序员老陆1 小时前
Docker 命令全景指南:从镜像构建到生产运维
运维·docker·容器
灯澜忆梦12 小时前
【minio】#1 | 简介与安装
docker·对象存储·minio
江湖有缘1 天前
3款开源绘图工具整理合集,可Docker一键部署!
docker·容器·开源
TTATTC1 天前
告别协议选型内耗:深入拆解微服务“内部 gRPC + 边界 REST”混合通信架构与 Envoy 转码实战
docker·开源
光依旧2 天前
PageIndex没翻车,翻车的是我的解析器
docker·langchain·大模型·向量数据库·pdf解析·rag·pageindex
谢亮_vipxieliang2 天前
容器排障实战手册:从日志到内核的分层排障
docker·云原生·容器·eureka
梦想不只是梦与想2 天前
Docker 常用命令
docker
小白的码BUG之路2 天前
Docker -- 构建ruoyi-gateway镜像
docker·容器·gateway
小白的码BUG之路2 天前
Docker -- 构建ruoyi-system镜像
运维·docker·容器