I believe in addition to CAP_SYS_NICE, you'll also need CAP_SYS_ADMIN. I can't say for sure but the kernel has a check for ioprio() that requires CAP_SYS_ADMIN && CAP_SYS_NICE for a "real-time" priority like SCHED_RR.
(Required permissions to set I/O priorities)
I ran into the same problem with any sched_setsched() calls returning a EPERM when I try to change scheduling priority within a container. I'm also getting EPERM error when I try the same change from the host to a process in the container.
EDIT: Actually, I'm wrong about this. I figure out how to get SCHED_RR to work for my setup. The call to sched_setscheduler() was erroring with EPERM because I hadn't set a real time budget in the cgroups folder.
Control Group policy does not allow for a real-time scheduling policy
to be set without allocating a run-time budget, which is not set by the