Skip to content

Commit 985866c

Browse files
stepanblyschakqiluo-msft
authored andcommitted
[docker_image_ctl.j2] Share UTS namespace with host OS (sonic-net#4169)
Instead of updating hostname manualy on Config DB hostname change, simply share containers UTS namespace with host OS. Ideally, instead of setting `--uts=host` for every container in SONiC, this setting can be set per container if feature requires. One behaviour change is introduced in this commit, when `--privileged` or `--cap-add=CAP_SYS_ADMIN` and `--uts=host` are combined, container has privilege to change host OS and every other container hostname. Such privilege should be fixed by limiting containers capabilities. Signed-off-by: Stepan Blyschak <[email protected]>
1 parent aa73dbd commit 985866c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

files/build_templates/docker_image_ctl.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ start() {
144144
# TODO: Mellanox will remove the --tmpfs exception after SDK socket path changed in new SDK version
145145
{%- endif %}
146146
docker create {{docker_image_run_opt}} \
147+
--uts=host \{# W/A: this should be set per-docker, for those dockers which really need host's UTS namespace #}
147148
{%- if install_debug_image == "y" %}
148149
-v /src:/src:ro -v /debug:/debug:rw \
149150
{%- endif %}

0 commit comments

Comments
 (0)