From 62a566ef2c04f0dc0785f4cdb3246a75036e437d Mon Sep 17 00:00:00 2001 From: shaw Date: Wed, 18 Mar 2026 14:11:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20config.yaml=20?= =?UTF-8?q?=E4=BB=A5=E5=8F=AA=E8=AF=BB=E6=96=B9=E5=BC=8F=E6=8C=82=E8=BD=BD?= =?UTF-8?q?=E6=97=B6=E5=AE=B9=E5=99=A8=E5=90=AF=E5=8A=A8=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=20(#1113)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit entrypoint 中 chown -R /app/data 在遇到 :ro 挂载的文件时报错退出, 添加错误容忍处理;同时去掉 compose 文件注释中的 :ro 建议。 --- deploy/docker-compose.local.yml | 2 +- deploy/docker-compose.yml | 2 +- deploy/docker-entrypoint.sh | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/deploy/docker-compose.local.yml b/deploy/docker-compose.local.yml index d404ac0b..5aea78fb 100644 --- a/deploy/docker-compose.local.yml +++ b/deploy/docker-compose.local.yml @@ -38,7 +38,7 @@ services: - ./data:/app/data # Optional: Mount custom config.yaml (uncomment and create the file first) # Copy config.example.yaml to config.yaml, modify it, then uncomment: - # - ./config.yaml:/app/data/config.yaml:ro + # - ./config.yaml:/app/data/config.yaml environment: # ======================================================================= # Auto Setup (REQUIRED for Docker deployment) diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index acd21fd9..a0bc1a60 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -30,7 +30,7 @@ services: - sub2api_data:/app/data # Optional: Mount custom config.yaml (uncomment and create the file first) # Copy config.example.yaml to config.yaml, modify it, then uncomment: - # - ./config.yaml:/app/data/config.yaml:ro + # - ./config.yaml:/app/data/config.yaml environment: # ======================================================================= # Auto Setup (REQUIRED for Docker deployment) diff --git a/deploy/docker-entrypoint.sh b/deploy/docker-entrypoint.sh index 344429bd..47ab6bf1 100644 --- a/deploy/docker-entrypoint.sh +++ b/deploy/docker-entrypoint.sh @@ -6,7 +6,8 @@ set -e # preventing the non-root sub2api user from writing files. if [ "$(id -u)" = "0" ]; then mkdir -p /app/data - chown -R sub2api:sub2api /app/data + # Use || true to avoid failure on read-only mounted files (e.g. config.yaml:ro) + chown -R sub2api:sub2api /app/data 2>/dev/null || true # Re-invoke this script as sub2api so the flag-detection below # also runs under the correct user. exec su-exec sub2api "$0" "$@"