Reputation: 21
I have a docker container, which has CPP code in it.
void SetRealtimeThreadPriority()
{
sched_param const param{ThreadPriorities::Priority()};
int result = pthread_setschedparam(pthread_self(), ThreadPriorities::Policy(), ¶m);
printf("SetRealtimeThreadPriority - result checked for assertion %d \n", result);
assert(result == 0); (void) result;
}
when I run the exe which has this code in ubuntu machine it works fine, where result printed is 0(zero). but when I run it in container, the assert is failing.
I have gone through multiple threads, man pages, docker run documentation and articles and tried running the container with below options, but no luck.
docker run -it --rm --cap-add SYS_NICE MyContainer
docker run --cap-add=ALL --privileged MyContainer
docker run --cap-add=ALL MyContainer
docker run -it --rm --userns host --cap-add SYS_NICE MyContainer
How can I debug this issue? Im running docker on wsl ubuntu 16.04.
Upvotes: 0
Views: 510
Reputation: 1068
You could insert some code. Perhaps you can tell what is different? For example, #include <sys/capability.h>
, and link with ... -lcap
, put this:
std::cout << cap_to_text(cap_get_proc(), NULL) << std::endl;
just before the call to pthread_setschedparam(2)
. Does it display something different inside and outside the container?
Upvotes: 0