Reputation: 3
I am using docker 1.11, I run a container like:
sudo docker run -it --rm --cpu-shares 4 zeroboh/stress --cpu 2
I want to change cpu-shares's value while docker container keeps running. Is there any method to do so?
I tried to edit file /sys/fs/cgroup/cpu/docker/[containerID]/cpu.shares
with VIM, but failed for "Fsync failed". It means I can't modify cgroup file directly?
Upvotes: 0
Views: 585
Reputation: 2384
You can do this:
echo 4 > /sys/fs/cgroup/cpu/docker/${ContainerID}/cpu.shares
instead of directly using vim.
Upvotes: 0
Reputation: 35348
I think docker update is the way to go.
Could look like this (taken from referenced documentation)
$ docker update --cpu-shares 512 abebf7571666
Upvotes: 1