fix: 运行数据改用命名卷,避免 bind mount 属主导致的 PermissionError
This commit is contained in:
1 parent
bc3b95f800
commit
b19a071a6e
2 files changed
+13
-2
No files matched your search
@@ -85,7 +85,13 @@ curl -s localhost:52100/healthz | python3 -m json.tool
|
|||||||
| `healthcheck.py` | 容器健康检查(判断是否还在轮询) |
|
| `healthcheck.py` | 容器健康检查(判断是否还在轮询) |
|
||||||
| `tests/test_core.py` | 22 项单元测试,不联网 |
|
| `tests/test_core.py` | 22 项单元测试,不联网 |
|
||||||
|
|
||||||
运行数据都在 `data/`(容器内 `/app/data`):`cookies.json`、`state.json`、`logs/monitor.log`。
|
运行数据都在容器内 `/app/data`(compose 用命名卷 `fengxiang-data` 持久化):
|
||||||
|
`cookies.json`、`state.json`、`logs/monitor.log`。查看/备份:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker volume inspect fengxiang-monitor_fengxiang-data # 宿主机实际路径
|
||||||
|
docker exec fengxiang-monitor ls -l /app/data
|
||||||
|
```
|
||||||
|
|
||||||
## 5. 管理接口
|
## 5. 管理接口
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -14,7 +14,9 @@ services:
|
|||||||
FX_LOG_LEVEL: ${FX_LOG_LEVEL:-INFO}
|
FX_LOG_LEVEL: ${FX_LOG_LEVEL:-INFO}
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.yaml:/app/config.yaml:ro
|
- ./config.yaml:/app/config.yaml:ro
|
||||||
- ./data:/app/data
|
# 运行数据用命名卷:Docker 会按镜像内 /app/data 的属主(10001)初始化,
|
||||||
|
# 换成 bind mount 需要手工 chown 10001:10001,否则容器非 root 用户写不进去
|
||||||
|
- fengxiang-data:/app/data
|
||||||
ports:
|
ports:
|
||||||
# 宿主机 52100 -> 容器 8089(管理/健康检查;Cookie 上传走这个口)
|
# 宿主机 52100 -> 容器 8089(管理/健康检查;Cookie 上传走这个口)
|
||||||
- "52100:8089"
|
- "52100:8089"
|
||||||
@@ -23,3 +25,6 @@ services:
|
|||||||
options:
|
options:
|
||||||
max-size: "10m"
|
max-size: "10m"
|
||||||
max-file: "3"
|
max-file: "3"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
fengxiang-data:
|
||||||
Reference in new issue
Block a user