From 467213f4282e7b54739b244952833c1488fc498e Mon Sep 17 00:00:00 2001 From: Salvador Girones Date: Mon, 20 Apr 2015 16:54:46 -0700 Subject: [PATCH] Add memswap_limit support Signed-off-by: Salvador Girones --- 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 f87da1d8c15..d224dca7f1a 100644 --- a/compose/config.py +++ b/compose/config.py @@ -19,6 +19,7 @@ 'image', 'links', 'mem_limit', + 'memswap_limit', 'net', 'pid', 'ports', diff --git a/docs/yml.md b/docs/yml.md index c375648df4f..4e89a46af73 100644 --- a/docs/yml.md +++ b/docs/yml.md @@ -283,7 +283,7 @@ 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, memswap\_limit, privileged, restart, stdin\_open, tty, cpu\_shares Each of these is a single value, analogous to its [docker run](https://docs.docker.com/reference/run/) counterpart. @@ -299,6 +299,7 @@ hostname: foo domainname: foo.com mem_limit: 1000000000 +memswap_limit: 2000000000 privileged: true restart: always diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index 4abd4a9096e..9e648f6287b 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -107,6 +107,12 @@ def test_create_container_with_cpu_shares(self): service.start_container(container) self.assertEqual(container.inspect()['Config']['CpuShares'], 73) + def test_create_container_with_memswap_limit(self): + service = self.create_service('db', memswap_limit='200m', mem_limit='200m') + container = service.create_container() + service.start_container(container) + self.assertEqual(container.inspect()['Config']['MemorySwap'], 209715200) + def test_create_container_with_specified_volume(self): host_path = '/tmp/host-path' container_path = '/container-path'