# 显式声明文件格式版本:Debian 11 等自带的 docker-compose v1(1.25.x)在缺少 version 时 # 会按远古的 version 1 格式解析,把 services 当成服务名而报错。Compose v2 会忽略此字段 # (仅打印一条 obsolete 提示),因此写上它对新旧两边都安全。3.7 覆盖了下面用到的 init/healthcheck。 version: "3.7" services: aegis-relay-agent: image: aegis-relay-agent:local restart: unless-stopped read_only: true init: true security_opt: ["no-new-privileges:true"] cap_drop: ["ALL"] user: "10001:10001" ports: # 不使用带默认值的变量插值:部分老版本 docker-compose(Debian 11 自带 1.25.x)会报 # "Invalid interpolation format"。这两个值在安装/更新脚本里本来就恒为下面的常量, # 写死可让 Compose 文件对任何版本都零解析风险。需要改绑定地址时直接改本文件。 - "127.0.0.1:8080:8080" volumes: - ./data:/app/agent-data env_file: .env environment: # V8 sizes its heap off host RAM by default; cap it so the agent stays small next to Emby traffic. NODE_OPTIONS: --max-old-space-size=192 tmpfs: ["/tmp:rw,noexec,nosuid,size=16m"] healthcheck: test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:8080/').then(r=>{if(!r.ok)process.exit(1)})"] interval: 30s timeout: 5s retries: 3