mirror of
https://github.com/docker/compose.git
synced 2025-07-26 07:04:32 +02:00
Merge pull request #4565 from shin-/onorua-pids-limit
Add pids_limit to service config
This commit is contained in:
commit
b454268f93
@ -88,6 +88,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',
|
||||||
|
@ -223,6 +223,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"},
|
||||||
|
@ -67,6 +67,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',
|
||||||
@ -774,6 +775,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,14 @@ 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)
|
||||||
|
|
||||||
|
@pytest.mark.xfail(True, reason='Some kernels/configs do not support pids_limit')
|
||||||
|
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)
|
||||||
|
assert 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…
x
Reference in New Issue
Block a user