From 0493b6274ead8719467d118a0ab4af9d064f6714 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Thu, 19 Sep 2019 09:09:25 -0700 Subject: [PATCH] Map /src & /debug for debug docker containers (#3470) * Add debug docker for SNMP. * Removed a redundant install of debug packages. Propagate the debug flag to template file to mount /dbg & /src to debug containers. * Revert the last change to retain the original --- files/build_templates/docker_image_ctl.j2 | 3 +++ slave.mk | 1 + 2 files changed, 4 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 426e519f1e48..215bdcc3b8ee 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -139,6 +139,9 @@ start() { # TODO: Mellanox will remove the --tmpfs exception after SDK socket path changed in new SDK version {%- endif %} docker create {{docker_image_run_opt}} \ +{%- if install_debug_image == "y" %} + -v /src:/src:ro -v /debug:/debug:rw \ +{%- endif %} {%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %} --log-opt max-size=2M --log-opt max-file=5 \ {%- endif %} diff --git a/slave.mk b/slave.mk index e4c6719641ab..a381a464dd94 100644 --- a/slave.mk +++ b/slave.mk @@ -581,6 +581,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))" export redis_dump_load_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY2))" + export install_debug_image="$(INSTALL_DEBUG_TOOLS)" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)"