Files
nexus/wiki/concepts/容器资源限制.md
2026-04-22 04:03:04 +08:00

30 lines
882 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 容器资源限制
## Description
通过 Docker 的 `deploy.resources.limits` 字段对容器可使用的资源内存、CPU进行上限约束防止单一容器耗尽宿主机资源影响其他服务稳定性。
## 常用配置
```yaml
deploy:
resources:
limits:
memory: 128M # 最大内存限制
cpus: '0.5' # 最大 CPU 配额50%
```
## 典型应用场景
- it-tools Web UI128MB 内存足够运行
- Jellyfin 媒体转码:建议 2-4GB 内存
- 数据库容器MariaDB建议 512MB-2GB
- Prometheus/Grafana建议 512MB-1GB
## 注意事项
- 内存限制 `128M` 对于简单 Web UI 工具足够
- 超出限制后容器可能被 OOM Killer 终止
- 建议结合健康检查healthcheck确保服务可用性
## Used By
- [[用docker安装it-tools]]
- [[Docker-Compose]]
- [[Navidrome]](转码缓存 200MB 限制)