I have a testenvironment for code in a docker image which I use by running bash in the container:
me@host$ docker run -ti myimage bash
Inside the container, I launch a program normally by saying
root@docker# ./myprogram
However, I want the process of myprogram to have a negative niceness (there are valid reasons for this). However:
root@docker# nice -n -7 ./myprogram
nice: cannot set niceness: Permission denied
Given that docker is run by the docker daemon which runs as root and I am root inside the container, why doesn't this work and how can force a negative niceness?
Note: The docker image is running debian/sid and the host is ubuntu/12.04.
Try adding
--privileged=true
to your run command.
[edit] privileged=true is the old method. Looks like
--cap-add=SYS_NICE
Should work as well.
You could also set the CPU priority of the whole container with -c
for CPU shares.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With