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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.