mirror of https://github.com/docker/compose.git
introducing pids_limit, fix for #4178
Signed-off-by: Yaroslav Molochko <y.molochko@anchorfree.com>
This commit is contained in:
parent
31b2d9176b
commit
6a151aac04
|
@ -87,6 +87,7 @@ DOCKER_CONFIG_KEYS = [
|
||||||
'secrets',
|
'secrets',
|
||||||
'security_opt',
|
'security_opt',
|
||||||
'shm_size',
|
'shm_size',
|
||||||
|
'pids_limit',
|
||||||
'stdin_open',
|
'stdin_open',
|
||||||
'stop_signal',
|
'stop_signal',
|
||||||
'sysctls',
|
'sysctls',
|
||||||
|
|
|
@ -216,6 +216,7 @@
|
||||||
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
|
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
|
||||||
"shm_size": {"type": ["number", "string"]},
|
"shm_size": {"type": ["number", "string"]},
|
||||||
"sysctls": {"$ref": "#/definitions/list_or_dict"},
|
"sysctls": {"$ref": "#/definitions/list_or_dict"},
|
||||||
|
"pids_limit": {"type": ["number", "string"]},
|
||||||
"stdin_open": {"type": "boolean"},
|
"stdin_open": {"type": "boolean"},
|
||||||
"stop_grace_period": {"type": "string", "format": "duration"},
|
"stop_grace_period": {"type": "string", "format": "duration"},
|
||||||
"stop_signal": {"type": "string"},
|
"stop_signal": {"type": "string"},
|
||||||
|
|
|
@ -168,6 +168,7 @@
|
||||||
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
|
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
|
||||||
"shm_size": {"type": ["number", "string"]},
|
"shm_size": {"type": ["number", "string"]},
|
||||||
"sysctls": {"$ref": "#/definitions/list_or_dict"},
|
"sysctls": {"$ref": "#/definitions/list_or_dict"},
|
||||||
|
"pids_limit": {"type": ["number", "string"]},
|
||||||
"stdin_open": {"type": "boolean"},
|
"stdin_open": {"type": "boolean"},
|
||||||
"stop_grace_period": {"type": "string", "format": "duration"},
|
"stop_grace_period": {"type": "string", "format": "duration"},
|
||||||
"stop_signal": {"type": "string"},
|
"stop_signal": {"type": "string"},
|
||||||
|
|
|
@ -66,6 +66,7 @@ DOCKER_START_KEYS = [
|
||||||
'oom_score_adj',
|
'oom_score_adj',
|
||||||
'mem_swappiness',
|
'mem_swappiness',
|
||||||
'pid',
|
'pid',
|
||||||
|
'pids_limit',
|
||||||
'privileged',
|
'privileged',
|
||||||
'restart',
|
'restart',
|
||||||
'security_opt',
|
'security_opt',
|
||||||
|
@ -772,6 +773,7 @@ class Service(object):
|
||||||
cpu_quota=options.get('cpu_quota'),
|
cpu_quota=options.get('cpu_quota'),
|
||||||
shm_size=options.get('shm_size'),
|
shm_size=options.get('shm_size'),
|
||||||
sysctls=options.get('sysctls'),
|
sysctls=options.get('sysctls'),
|
||||||
|
pids_limit=options.get('pids_limit'),
|
||||||
tmpfs=options.get('tmpfs'),
|
tmpfs=options.get('tmpfs'),
|
||||||
oom_score_adj=options.get('oom_score_adj'),
|
oom_score_adj=options.get('oom_score_adj'),
|
||||||
mem_swappiness=options.get('mem_swappiness'),
|
mem_swappiness=options.get('mem_swappiness'),
|
||||||
|
|
|
@ -115,6 +115,13 @@ class ServiceTest(DockerClientTestCase):
|
||||||
service.start_container(container)
|
service.start_container(container)
|
||||||
self.assertEqual(container.get('HostConfig.ShmSize'), 67108864)
|
self.assertEqual(container.get('HostConfig.ShmSize'), 67108864)
|
||||||
|
|
||||||
|
def test_create_container_with_pids_limit(self):
|
||||||
|
self.require_api_version('1.23')
|
||||||
|
service = self.create_service('db', pids_limit=10)
|
||||||
|
container = service.create_container()
|
||||||
|
service.start_container(container)
|
||||||
|
self.assertEqual(container.get('HostConfig.PidsLimit'), 10)
|
||||||
|
|
||||||
def test_create_container_with_extra_hosts_list(self):
|
def test_create_container_with_extra_hosts_list(self):
|
||||||
extra_hosts = ['somehost:162.242.195.82', 'otherhost:50.31.209.229']
|
extra_hosts = ['somehost:162.242.195.82', 'otherhost:50.31.209.229']
|
||||||
service = self.create_service('db', extra_hosts=extra_hosts)
|
service = self.create_service('db', extra_hosts=extra_hosts)
|
||||||
|
|
Loading…
Reference in New Issue