Custom cadvisor build with Unraid compatibility patches (smaps EPERM + mapper device loop)
  • Shell 80.6%
  • Dockerfile 19.4%
Find a file
SysAdmin Pete a221e3f851
All checks were successful
Build cadvisor-unraid / build-push (push) Successful in 4s
fix: correct build path for v0.56.2 and patch patterns
- 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)
2026-04-30 13:59:03 +00:00
.forgejo/workflows fix: remove container.options --network (runner config already sets forgejo-backend; duplicate causes Docker error) 2026-04-30 08:26:20 -05:00
patches fix: correct build path for v0.56.2 and patch patterns 2026-04-30 13:59:03 +00:00
Dockerfile fix: correct build path for v0.56.2 and patch patterns 2026-04-30 13:59:03 +00:00
README.md Initial commit: cadvisor with Unraid compatibility patches 2026-04-30 12:45:32 +00:00

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

  1. Edit CADVISOR_VERSION in Dockerfile
  2. Push to main
  3. CI builds and pushes updated image
  4. On Tower: docker compose pull && docker compose up -d in 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