summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-05-17 10:24:10 -0500
committerGitHub <noreply@github.com>2024-05-17 10:24:10 -0500
commitc015e36778aa8ee2b679b313dcd12a8b0739d101 (patch)
tree7a0fa847478bd59a7e2b33e1d12aefabad81bbc4 /src
parentbadc6a27571b4af04f80cda4bae6931ed9d8c286 (diff)
parent3f83be294b4a47f09658ac43314421ee6223a9aa (diff)
downloadvyos-1x-c015e36778aa8ee2b679b313dcd12a8b0739d101.tar.gz
vyos-1x-c015e36778aa8ee2b679b313dcd12a8b0739d101.zip
Merge pull request #3476 from vyos/mergify/bp/sagitta/pr-3472
T6358: Container config option to enable host pid (backport #3472)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/container.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py
index a73a18ffa..91a10e891 100755
--- a/src/conf_mode/container.py
+++ b/src/conf_mode/container.py
@@ -329,9 +329,13 @@ def generate_run_arguments(name, container_config):
prop = vol_config['propagation']
volume += f' --volume {svol}:{dvol}:{mode},{prop}'
+ host_pid = ''
+ if 'allow_host_pid' in container_config:
+ host_pid = '--pid host'
+
container_base_cmd = f'--detach --interactive --tty --replace {capabilities} ' \
f'--memory {memory}m --shm-size {shared_memory}m --memory-swap 0 --restart {restart} ' \
- f'--name {name} {hostname} {device} {port} {volume} {env_opt} {label} {uid}'
+ f'--name {name} {hostname} {device} {port} {volume} {env_opt} {label} {uid} {host_pid}'
entrypoint = ''
if 'entrypoint' in container_config:
@@ -339,11 +343,6 @@ def generate_run_arguments(name, container_config):
entrypoint = json_write(container_config['entrypoint'].split()).replace('"', "&quot;")
entrypoint = f'--entrypoint &apos;{entrypoint}&apos;'
- hostname = ''
- if 'host_name' in container_config:
- hostname = container_config['host_name']
- hostname = f'--hostname {hostname}'
-
command = ''
if 'command' in container_config:
command = container_config['command'].strip()