-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
How do I use lxc_conf
in start
?
I'd like to set cpu and cpu shares, something like this:
docker run -i -t -lxc-conf="lxc.cgroup.cpu.shares=1" -lxc-conf="lxc.cgroup.cpuset.cpus=0" my_image /bin/bash stress_cpu.sh
According to the documentation I should be able to pass a dictionary:
lxc_conf allows to pass LXC configuration options in dict form.
So my code looks like this:
self.client.start(container, lxc_conf = self.get_lxc_conf())
def get_lxc_conf(self):
return {
#Restrict container to a core
'lxc.cgroup.cpuset.cpus' : str(self.cpu_number),
#All containers get the same share
'lxc.cgroup.cpu.cpu.shares' : str(1)
}
However, I can't get it work, I keep getting the following error message:
500 Server Error: Internal Server Error ("json: cannot unmarshal object into Go value of type []docker.KeyValuePair")
I get the same error even with the dictionary example in the API docs:
def get_lxc_conf(self):
return {"lxc.utsname":"docker"}
I've tried passing lists and strings
Thanks!
Metadata
Metadata
Assignees
Labels
No labels