From 688f82c1cf12a7eb771ef543d4744fd89497f8d3 Mon Sep 17 00:00:00 2001 From: xuxinkun Date: Thu, 23 Apr 2015 09:33:46 +0800 Subject: [PATCH] Add cpuset config. Signed-off-by: xuxinkun --- compose/config.py | 1 + docs/yml.md | 3 ++- tests/integration/service_test.py | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compose/config.py b/compose/config.py index 6455d7842..c50ae211a 100644 --- a/compose/config.py +++ b/compose/config.py @@ -7,6 +7,7 @@ DOCKER_CONFIG_KEYS = [ 'cap_add', 'cap_drop', 'cpu_shares', + 'cpuset', 'command', 'detach', 'dns', diff --git a/docs/yml.md b/docs/yml.md index 101c2cf27..848c34a3f 100644 --- a/docs/yml.md +++ b/docs/yml.md @@ -310,13 +310,14 @@ dns_search: - dc2.example.com ``` -### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares +### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares, cpuset Each of these is a single value, analogous to its [docker run](https://docs.docker.com/reference/run/) counterpart. ``` cpu_shares: 73 +cpuset: 0,1 working_dir: /code entrypoint: /code/entrypoint.sh diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index 3fbf546c0..c3d121952 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -167,6 +167,12 @@ class ServiceTest(DockerClientTestCase): service.start_container(container) self.assertEqual(set(container.get('HostConfig.ExtraHosts')), set(extra_hosts_list)) + def test_create_container_with_cpu_set(self): + service = self.create_service('db', cpuset='0') + container = service.create_container() + service.start_container(container) + self.assertEqual(container.inspect()['Config']['Cpuset'], '0') + def test_create_container_with_specified_volume(self): host_path = '/tmp/host-path' container_path = '/container-path'