summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-23 14:03:36 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-23 14:03:36 +0200
commite0b2453bd0399d387f4a4d0c4f2e12509249db27 (patch)
tree8613139fcc0255410370419a7a7537436a14d113 /src
parente71a98562aabea53cb9b5e1958398e1e674490bb (diff)
downloadvyos-1x-e0b2453bd0399d387f4a4d0c4f2e12509249db27.tar.gz
vyos-1x-e0b2453bd0399d387f4a4d0c4f2e12509249db27.zip
containers: T2216: restructure container_base_cmd to have image name at the end
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/containers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/conf_mode/containers.py b/src/conf_mode/containers.py
index fd0c5e52d..7aea5f432 100755
--- a/src/conf_mode/containers.py
+++ b/src/conf_mode/containers.py
@@ -233,8 +233,8 @@ def apply(container):
# Check/set environment options "-e foo=bar"
env_opt = ''
if 'environment' in container_config:
- env_opt = '-e '
- env_opt += " -e ".join(f"{k}={v['value']}" for k, v in container_config['environment'].items())
+ for k, v in container_config['environment'].items():
+ env_opt += f" -e \"{k}={v['value']}\""
# Publish ports
port = ''
@@ -258,15 +258,15 @@ def apply(container):
dvol = vol_config['destination']
volume += f' -v {svol}:{dvol}'
- container_base_cmd = f'podman run -dit --name {name} --memory {memory} --restart {restart} {port} {volume} {env_opt} {image}'
+ container_base_cmd = f'podman run -dit --name {name} --memory {memory}m --restart {restart} {port} {volume} {env_opt}'
if 'allow_host_networks' in container_config:
- _cmd(f'{container_base_cmd} --net host')
+ _cmd(f'{container_base_cmd} --net host {image}')
else:
for network in container_config['network']:
ipparam = ''
if 'address' in container_config['network'][network]:
ipparam = '--ip ' + container_config['network'][network]['address']
- _cmd(f'{container_base_cmd} --net {network} {ipparam}')
+ _cmd(f'{container_base_cmd} --net {network} {ipparam} {image}')
# Else container is already created. Just start it.
# It's needed after reboot.