diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-17 15:36:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 15:36:03 +0200 |
commit | e53dd75a149e891043a875bb6269fe22da99f586 (patch) | |
tree | 44389aff2dea12d77765a233fc30a340746147b2 /src/conf_mode | |
parent | 17e460792b17de2e6f358daa86abcd6b76d5ba40 (diff) | |
parent | f5051de4fc034bd95677ef142423e59eae47cd2f (diff) | |
download | vyos-1x-e53dd75a149e891043a875bb6269fe22da99f586.tar.gz vyos-1x-e53dd75a149e891043a875bb6269fe22da99f586.zip |
Merge pull request #3472 from nvollmar/T6358
T6358: Container config option to enable host pid
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/container.py | 11 |
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('"', """) entrypoint = f'--entrypoint '{entrypoint}'' - 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() |