mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-04-02 22:42:14 +08:00
fix: 修复 config.yaml 以只读方式挂载时容器启动失败 (#1113)
entrypoint 中 chown -R /app/data 在遇到 :ro 挂载的文件时报错退出, 添加错误容忍处理;同时去掉 compose 文件注释中的 :ro 建议。
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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" "$@"
|
||||
|
||||
Reference in New Issue
Block a user