- Shell 80.6%
- Dockerfile 19.4%
|
All checks were successful
Build cadvisor-unraid / build-push (push) Successful in 4s
- Dockerfile: ./cmd/cadvisor/ -> ./cmd/ (main package moved in v0.50+) - Dockerfile: cd cmd for separate go.mod in cmd/ directory - Patches: match errors.Is(err, os.ErrNotExist) pattern (v0.56.2 style) - Patches: add processMounts() skip for /dev/mapper/md* devices - Remove unused ci/Dockerfile (using agents/ci-base instead) |
||
|---|---|---|
| .forgejo/workflows | ||
| patches | ||
| Dockerfile | ||
| README.md | ||
cadvisor-unraid
Custom cadvisor build with patches for Unraid compatibility.
Problem
Stock cadvisor has two bugs that make it unusable on Unraid:
1. smaps Memory Leak
Unraid's kernel restricts /proc/{pid}/smaps access. cadvisor gets EPERM errors but only handles ENOENT, entering a tight error loop that consumes ~100 MiB/sec of RAM until OOM.
Fix: Treat EPERM the same as ENOENT in container/libcontainer/handler.go. Demote the warning to debug-level logging.
2. /dev/mapper CPU Spin
Unraid's LUKS array uses device names like /dev/mapper/md0 (no partition suffix). cadvisor expects partition-suffixed names like md0p1 and falls back to an O(N) scan of all disk stats on every housekeeping cycle, pinning a CPU core at 70%+.
Fix: Skip Unraid array devices (/dev/mapper/md*, /dev/md*) in filesystem info collection. These aren't relevant to container metrics.
Building
# Build with default cadvisor version
docker build -t cadvisor-unraid .
# Build with specific version
docker build --build-arg CADVISOR_VERSION=v0.56.2 -t cadvisor-unraid .
CI/CD
Pushes to main trigger an automatic build via Forgejo Actions. The image is pushed to:
git.lab.lostsource.net/builds/cadvisor-unraid:latest
Updating cadvisor Version
- Edit
CADVISOR_VERSIONinDockerfile - Push to main
- CI builds and pushes updated image
- On Tower:
docker compose pull && docker compose up -din the prometheus-grafana stack
If patches fail to apply on a new version, check patches/apply-patches.sh — the sed patterns may need updating for refactored code.
Version String
The build injects -unraid into the cadvisor version string:
cadvisor version: v0.56.2-unraid