Add in memswap_limit run option

By allowing the memswap_limit option to be defined we also need to
check that mem_limit is set, you can't have swap without a limit.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-07-06 17:07:31 +01:00
commit fc26982132
4 changed files with 39 additions and 1 deletions

View file

@ -31,6 +31,7 @@ DOCKER_CONFIG_KEYS = [
'links',
'mac_address',
'mem_limit',
'memswap_limit',
'net',
'log_driver',
'pid',
@ -61,6 +62,7 @@ DOCKER_CONFIG_HINTS = {
'extra_host': 'extra_hosts',
'device': 'devices',
'link': 'links',
'memory_swap': 'memswap_limit',
'port': 'ports',
'privilege': 'privileged',
'priviliged': 'privileged',
@ -244,6 +246,9 @@ def process_container_options(service_dict, working_dir=None):
service_dict = service_dict.copy()
if 'memswap_limit' in service_dict and 'mem_limit' not in service_dict:
raise ConfigurationError("Invalid 'memswap_limit' configuration for %s service: when defining 'memswap_limit' you must set 'mem_limit' as well" % service_dict['name'])
if 'volumes' in service_dict:
service_dict['volumes'] = resolve_volume_paths(service_dict['volumes'], working_dir=working_dir)