Add support for swappiness constraint

Run a service using `docker run --memory-swappiness=0` (see
https://docs.docker.com/engine/reference/run/)

refs #2383

Signed-off-by: Jean-François Roche <jfroche@affinitic.be>
This commit is contained in:
Jean-François Roche 2016-06-01 21:15:12 +02:00
commit d824cb9b06
7 changed files with 31 additions and 2 deletions

View file

@ -69,6 +69,7 @@ DOCKER_CONFIG_KEYS = [
'mac_address',
'mem_limit',
'memswap_limit',
'mem_swappiness',
'net',
'oom_score_adj'
'pid',

View file

@ -85,6 +85,7 @@
"mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]},
"memswap_limit": {"type": ["number", "string"]},
"mem_swappiness": {"type": "integer"},
"net": {"type": "string"},
"pid": {"type": ["string", "null"]},

View file

@ -139,6 +139,7 @@
"mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]},
"memswap_limit": {"type": ["number", "string"]},
"mem_swappiness": {"type": "integer"},
"network_mode": {"type": "string"},
"networks": {

View file

@ -55,6 +55,7 @@ DOCKER_START_KEYS = [
'mem_limit',
'memswap_limit',
'oom_score_adj',
'mem_swappiness',
'pid',
'privileged',
'restart',
@ -704,7 +705,8 @@ class Service(object):
cpu_quota=options.get('cpu_quota'),
shm_size=options.get('shm_size'),
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')
)
def build(self, no_cache=False, pull=False, force_rm=False):