summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStepan Stipl <stepan@stipl.net>2016-08-31 18:30:29 +0100
committerJoffrey F <joffrey@docker.com>2016-11-28 11:42:00 -0800
commit7ef48c3769cc42115b59157847275b2d072d7e5f (patch)
treef9bd81f7f27ae020cc7d813f32ecfd6eef6d8ac6
parentf051f7e90a26e83e1ea5ae2957fa4c3602a07eca (diff)
downloaddocker-py-7ef48c3769cc42115b59157847275b2d072d7e5f.tar.gz
Allow custom PID mode for the container
Docker added support for sharing PID namespaces with other containers since version 1.12 (see https://github.com/docker/docker/pull/22481). Signed-off-by: Stepan Stipl <stepan@stipl.net>
-rw-r--r--docker/utils/utils.py4
-rw-r--r--tests/integration/api_container_test.py3
2 files changed, 1 insertions, 6 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index b107f22..f4ad6f8 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -735,9 +735,7 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
host_config['ShmSize'] = shm_size
- if pid_mode not in (None, 'host'):
- raise host_config_value_error('pid_mode', pid_mode)
- elif pid_mode:
+ if pid_mode:
host_config['PidMode'] = pid_mode
if ipc_mode:
diff --git a/tests/integration/api_container_test.py b/tests/integration/api_container_test.py
index a5be6e7..60c6ec0 100644
--- a/tests/integration/api_container_test.py
+++ b/tests/integration/api_container_test.py
@@ -365,9 +365,6 @@ class CreateContainerTest(BaseAPIIntegrationTest):
self.assertRaises(TypeError,
self.client.create_host_config, mem_swappiness='40')
- self.assertRaises(ValueError,
- self.client.create_host_config, pid_mode='40')
-
def test_create_with_environment_variable_no_value(self):
container = self.client.create_container(
BUSYBOX,