fix: container crash when started with --user flag (Unraid)#49
Conversation
When Unraid (or any Docker --user flag) runs the container as non-root, su-exec fails with "setgroups: Operation not permitted" because it cannot call setgroups() without CAP_SETGID. Fix: detect non-root at entrypoint start and exec directly, skipping su-exec and privilege-related setup. Also move /data chown before su-exec so bind-mounted host dirs get correct ownership. Closes #48
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesEntrypoint privilege handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
su-execwhen container is already running as non-root (e.g. Unraid--user 99:100)/dataownership fix before privilege drop so bind-mounted host dirs get correct permissionsRoot Cause
Unraid starts containers with
--user 99:100(nobody:users). The entrypoint calledsu-exec cashpilotwhich internally callssetgroups()— this requiresCAP_SETGIDwhich is unavailable when already non-root. Result: immediate crash withsu-exec: setgroups: Operation not permitted.Test Plan
--user 99:100(Unraid pattern)/datavolume/fleetpermission error is non-fatal warning (expected without fleet volume)Closes #48
Summary by CodeRabbit