Add support for shm_size. Fixes #2823.

shm_size controls the size of /dev/shm in the container and requires
Docker 1.10 or newer (API version 1.22).  This requires docker-py 1.8.0
(docker/docker-py#923).

Similar to fields like `mem_limit`, `shm_size` may be specified as
either an integer or a string (e.g., `64M`).

Updating docker-py to the master branch in order to get the unreleased
dependency on `shm_size` there in place.

Signed-off-by: Spencer Rinehart <anubis@overthemonkey.com>
This commit is contained in:
Spencer Rinehart 2016-02-05 10:47:14 -06:00
commit 5e6dc3521c
7 changed files with 14 additions and 2 deletions

View file

@ -102,6 +102,12 @@ class ServiceTest(DockerClientTestCase):
container.start()
self.assertEqual(container.get('HostConfig.CpuQuota'), 40000)
def test_create_container_with_shm_size(self):
service = self.create_service('db', shm_size=67108864)
container = service.create_container()
service.start_container(container)
self.assertEqual(container.get('HostConfig.ShmSize'), 67108864)
def test_create_container_with_extra_hosts_list(self):
extra_hosts = ['somehost:162.242.195.82', 'otherhost:50.31.209.229']
service = self.create_service('db', extra_hosts=extra_hosts)