0

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?

DAXaholic
  • 33,312
  • 6
  • 76
  • 74
h22q
  • 3
  • 3

2 Answers2

1

I think docker update is the way to go. Could look like this (taken from referenced documentation)
$ docker update --cpu-shares 512 abebf7571666

DAXaholic
  • 33,312
  • 6
  • 76
  • 74
0

You can do this:

echo 4 > /sys/fs/cgroup/cpu/docker/${ContainerID}/cpu.shares

instead of directly using vim.

fibonacci
  • 2,254
  • 2
  • 17
  • 13