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.