Add ulimit option for run action

This will allow to set ulimit for a container.

Change-Id: I0cfcf4e3e3e13578ec42e12f459732992fb3a760
Related-Bug: #1760471
This commit is contained in:
yatin 2018-04-06 10:20:36 +05:30
parent 4a4f43ac36
commit 9348078452
3 changed files with 13 additions and 0 deletions

View File

@ -158,6 +158,9 @@ class ComposeV1Builder(object):
cmd.append('--pid=%s' % cconfig['pid'])
if 'uts' in cconfig:
cmd.append('--uts=%s' % cconfig['uts'])
for u in cconfig.get('ulimit', []):
if u:
cmd.append('--ulimit=%s' % u)
if 'healthcheck' in cconfig:
hconfig = cconfig['healthcheck']
if 'test' in hconfig:

View File

@ -451,6 +451,7 @@ three-12345678 three''', '', 0),
'interactive': True,
'environment': ['FOO=BAR', 'BAR=BAZ'],
'env_file': ['/tmp/foo.env', '/tmp/bar.env'],
'ulimit': ['nofile=1024', 'nproc=1024'],
'volumes': ['/foo:/foo:rw', '/bar:/bar:ro'],
'volumes_from': ['two', 'three']
}
@ -464,6 +465,7 @@ three-12345678 three''', '', 0),
'--env-file=/tmp/foo.env', '--env-file=/tmp/bar.env',
'--env=FOO=BAR', '--env=BAR=BAZ',
'--rm', '--interactive', '--tty',
'--ulimit=nofile=1024', '--ulimit=nproc=1024',
'--volume=/foo:/foo:rw', '--volume=/bar:/bar:ro',
'--volumes-from=two', '--volumes-from=three',
'centos:7', 'ls', '-l', '/foo'],

View File

@ -0,0 +1,8 @@
---
features:
- |
Add `--ulimit=xxx` option for paunch run action. Using
this option, multiple ulimits can be set for the container.
For example, `--ulimit=nproc=1024 --ulimit=nofile=1024` will
set proc and nofile limit to 1024 for the container.