mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-08 00:04:38 +02:00
Pass ulimit parameters when building container
When running podman-compose build, pass ulimit arguments from docker-compose.yml through to podman build.
This commit is contained in:
parent
dacc7538ec
commit
efcbc75f63
@ -442,6 +442,21 @@ def mount_desc_to_args(compose, mount_desc, srv_name, cnt_name):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def container_to_ulimit_args(cnt, podman_args):
|
||||||
|
ulimit = cnt.get('ulimits', [])
|
||||||
|
if ulimit is not None:
|
||||||
|
# ulimit can be a single value, i.e. ulimit: host
|
||||||
|
if is_str(ulimit):
|
||||||
|
podman_args.extend(['--ulimit', ulimit])
|
||||||
|
# or a dictionary or list:
|
||||||
|
else:
|
||||||
|
ulimit = norm_as_dict(ulimit)
|
||||||
|
ulimit = [ "{}={}".format(ulimit_key, norm_ulimit(inner_value)) for ulimit_key, inner_value in ulimit.items()]
|
||||||
|
for i in ulimit:
|
||||||
|
podman_args.extend(['--ulimit', i])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def container_to_args(compose, cnt, detached=True, podman_command='run'):
|
def container_to_args(compose, cnt, detached=True, podman_command='run'):
|
||||||
# TODO: double check -e , --add-host, -v, --read-only
|
# TODO: double check -e , --add-host, -v, --read-only
|
||||||
dirname = compose.dirname
|
dirname = compose.dirname
|
||||||
@ -506,17 +521,7 @@ def container_to_args(compose, cnt, detached=True, podman_command='run'):
|
|||||||
podman_args.append('--tty')
|
podman_args.append('--tty')
|
||||||
if cnt.get('privileged'):
|
if cnt.get('privileged'):
|
||||||
podman_args.append('--privileged')
|
podman_args.append('--privileged')
|
||||||
ulimit = cnt.get('ulimits', [])
|
container_to_ulimit_args(cnt, podman_args)
|
||||||
if ulimit is not None:
|
|
||||||
# ulimit can be a single value, i.e. ulimit: host
|
|
||||||
if is_str(ulimit):
|
|
||||||
podman_args.extend(['--ulimit', ulimit])
|
|
||||||
# or a dictionary or list:
|
|
||||||
else:
|
|
||||||
ulimit = norm_as_dict(ulimit)
|
|
||||||
ulimit = [ "{}={}".format(ulimit_key, norm_ulimit(inner_value)) for ulimit_key, inner_value in ulimit.items()]
|
|
||||||
for i in ulimit:
|
|
||||||
podman_args.extend(['--ulimit', i])
|
|
||||||
# currently podman shipped by fedora does not package this
|
# currently podman shipped by fedora does not package this
|
||||||
# if cnt.get('init'):
|
# if cnt.get('init'):
|
||||||
# args.append('--init')
|
# args.append('--init')
|
||||||
@ -1003,6 +1008,7 @@ def build_one(compose, args, cnt):
|
|||||||
"build", "-t", cnt["image"],
|
"build", "-t", cnt["image"],
|
||||||
"-f", dockerfile
|
"-f", dockerfile
|
||||||
]
|
]
|
||||||
|
container_to_ulimit_args(cnt, build_args)
|
||||||
if getattr(args, 'pull_always', None): build_args.append("--pull-always")
|
if getattr(args, 'pull_always', None): build_args.append("--pull-always")
|
||||||
elif getattr(args, 'pull', None): build_args.append("--pull")
|
elif getattr(args, 'pull', None): build_args.append("--pull")
|
||||||
args_list = norm_as_list(build_desc.get('args', {}))
|
args_list = norm_as_list(build_desc.get('args', {}))
|
||||||
|
Loading…
Reference in New Issue
Block a user