Add ulimit option for run action
This will allow to set ulimit for a container.
Change-Id: I0cfcf4e3e3e13578ec42e12f459732992fb3a760
Related-Bug: #1760471
(cherry picked from commit 9348078452
)
This commit is contained in:
parent
5697cbe9d9
commit
e1b6ae7c13
|
@ -158,6 +158,9 @@ class ComposeV1Builder(object):
|
||||||
cmd.append('--pid=%s' % cconfig['pid'])
|
cmd.append('--pid=%s' % cconfig['pid'])
|
||||||
if 'uts' in cconfig:
|
if 'uts' in cconfig:
|
||||||
cmd.append('--uts=%s' % cconfig['uts'])
|
cmd.append('--uts=%s' % cconfig['uts'])
|
||||||
|
for u in cconfig.get('ulimit', []):
|
||||||
|
if u:
|
||||||
|
cmd.append('--ulimit=%s' % u)
|
||||||
if 'healthcheck' in cconfig:
|
if 'healthcheck' in cconfig:
|
||||||
hconfig = cconfig['healthcheck']
|
hconfig = cconfig['healthcheck']
|
||||||
if 'test' in hconfig:
|
if 'test' in hconfig:
|
||||||
|
|
|
@ -447,6 +447,7 @@ three-12345678 three''', '', 0),
|
||||||
'interactive': True,
|
'interactive': True,
|
||||||
'environment': ['FOO=BAR', 'BAR=BAZ'],
|
'environment': ['FOO=BAR', 'BAR=BAZ'],
|
||||||
'env_file': ['/tmp/foo.env', '/tmp/bar.env'],
|
'env_file': ['/tmp/foo.env', '/tmp/bar.env'],
|
||||||
|
'ulimit': ['nofile=1024', 'nproc=1024'],
|
||||||
'volumes': ['/foo:/foo:rw', '/bar:/bar:ro'],
|
'volumes': ['/foo:/foo:rw', '/bar:/bar:ro'],
|
||||||
'volumes_from': ['two', 'three']
|
'volumes_from': ['two', 'three']
|
||||||
}
|
}
|
||||||
|
@ -460,6 +461,7 @@ three-12345678 three''', '', 0),
|
||||||
'--env-file=/tmp/foo.env', '--env-file=/tmp/bar.env',
|
'--env-file=/tmp/foo.env', '--env-file=/tmp/bar.env',
|
||||||
'--env=FOO=BAR', '--env=BAR=BAZ',
|
'--env=FOO=BAR', '--env=BAR=BAZ',
|
||||||
'--rm', '--interactive', '--tty',
|
'--rm', '--interactive', '--tty',
|
||||||
|
'--ulimit=nofile=1024', '--ulimit=nproc=1024',
|
||||||
'--volume=/foo:/foo:rw', '--volume=/bar:/bar:ro',
|
'--volume=/foo:/foo:rw', '--volume=/bar:/bar:ro',
|
||||||
'--volumes-from=two', '--volumes-from=three',
|
'--volumes-from=two', '--volumes-from=three',
|
||||||
'centos:7', 'ls', '-l', '/foo'],
|
'centos:7', 'ls', '-l', '/foo'],
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue