From 15e0ab92618b0d5b9c7974ceb7910caeb13542bd Mon Sep 17 00:00:00 2001 From: Muayyad alsadi Date: Wed, 12 Jan 2022 15:44:47 +0200 Subject: [PATCH] FIXES #397: support host network mode --- podman_compose.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index b2d3004..3255c6c 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -636,9 +636,6 @@ def container_to_args(compose, cnt, detached=True): podman_args.append('--read-only') for i in cnt.get('labels', []): podman_args.extend(['--label', i]) - net = cnt.get("network_mode", None) - if net: - podman_args.extend(['--network', net]) for c in cnt.get('cap_add', []): podman_args.extend(['--cap-add', c]) for c in cnt.get('cap_drop', []): @@ -659,8 +656,14 @@ def container_to_args(compose, cnt, detached=True): podman_args.extend(['--tmpfs', i]) for volume in cnt.get('volumes', []): podman_args.extend(get_mount_args(compose, cnt, volume)) - assert_cnt_nets(compose, cnt) - podman_args.extend(get_net_args(compose, cnt)) + + net = cnt.get("network_mode", None) + if net: + podman_args.extend(['--network', net]) + else: + assert_cnt_nets(compose, cnt) + podman_args.extend(get_net_args(compose, cnt)) + log = cnt.get('logging') if log is not None: podman_args.append(f'--log-driver={log.get("driver", "k8s-file")}')