mirror of https://github.com/docker/compose.git
Add support for oom_kill_disable in service config
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
b30cb77a7b
commit
80503da476
|
@ -91,6 +91,7 @@ DOCKER_CONFIG_KEYS = [
|
|||
'mem_swappiness',
|
||||
'net',
|
||||
'oom_score_adj',
|
||||
'oom_kill_disable',
|
||||
'pid',
|
||||
'ports',
|
||||
'privileged',
|
||||
|
|
|
@ -229,6 +229,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"oom_kill_disable": {"type": "boolean"},
|
||||
"oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
|
||||
"group_add": {
|
||||
"type": "array",
|
||||
|
|
|
@ -235,6 +235,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"oom_kill_disable": {"type": "boolean"},
|
||||
"oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
|
||||
"group_add": {
|
||||
"type": "array",
|
||||
|
|
|
@ -237,6 +237,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"oom_kill_disable": {"type": "boolean"},
|
||||
"oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
|
||||
"group_add": {
|
||||
"type": "array",
|
||||
|
|
|
@ -156,6 +156,7 @@ class ConversionMap(object):
|
|||
service_path('deploy', 'update_config', 'max_failure_ratio'): float,
|
||||
service_path('deploy', 'restart_policy', 'max_attempts'): to_int,
|
||||
service_path('mem_swappiness'): to_int,
|
||||
service_path('oom_kill_disable'): to_boolean,
|
||||
service_path('oom_score_adj'): to_int,
|
||||
service_path('ports', 'target'): to_int,
|
||||
service_path('ports', 'published'): to_int,
|
||||
|
|
|
@ -77,6 +77,7 @@ HOST_CONFIG_KEYS = [
|
|||
'mem_reservation',
|
||||
'memswap_limit',
|
||||
'mem_swappiness',
|
||||
'oom_kill_disable',
|
||||
'oom_score_adj',
|
||||
'pid',
|
||||
'pids_limit',
|
||||
|
@ -859,6 +860,7 @@ class Service(object):
|
|||
sysctls=options.get('sysctls'),
|
||||
pids_limit=options.get('pids_limit'),
|
||||
tmpfs=options.get('tmpfs'),
|
||||
oom_kill_disable=options.get('oom_kill_disable'),
|
||||
oom_score_adj=options.get('oom_score_adj'),
|
||||
mem_swappiness=options.get('mem_swappiness'),
|
||||
group_add=options.get('group_add'),
|
||||
|
|
|
@ -239,8 +239,7 @@ class ServiceTest(DockerClientTestCase):
|
|||
service.start_container(container)
|
||||
self.assertEqual(set(container.get('HostConfig.SecurityOpt')), set(security_opt))
|
||||
|
||||
# @pytest.mark.xfail(True, reason='Not supported on most drivers')
|
||||
@pytest.mark.skipif(True, reason='https://github.com/moby/moby/issues/34270')
|
||||
@pytest.mark.xfail(True, reason='Not supported on most drivers')
|
||||
def test_create_container_with_storage_opt(self):
|
||||
storage_opt = {'size': '1G'}
|
||||
service = self.create_service('db', storage_opt=storage_opt)
|
||||
|
@ -248,6 +247,12 @@ class ServiceTest(DockerClientTestCase):
|
|||
service.start_container(container)
|
||||
self.assertEqual(container.get('HostConfig.StorageOpt'), storage_opt)
|
||||
|
||||
def test_create_container_with_oom_kill_disable(self):
|
||||
self.require_api_version('1.20')
|
||||
service = self.create_service('db', oom_kill_disable=True)
|
||||
container = service.create_container()
|
||||
assert container.get('HostConfig.OomKillDisable') is True
|
||||
|
||||
def test_create_container_with_mac_address(self):
|
||||
service = self.create_service('db', mac_address='02:42:ac:11:65:43')
|
||||
container = service.create_container()
|
||||
|
|
Loading…
Reference in New Issue