[docker_img_ctl.j2] make tmpfs mounts optional and add ability to run container by image id (#6439)
- Why I did it I made the docker_img_ctl.j2 applicable for more dockers (including application extensions dockers) by adding an option not to mount tmpfs on /tmp/ and /var/tmp/. In some applications /tmp/ is a different docker volume which can't be tmpfs. Also, I added and ability to pass REPO[:TAG]|[@digest]/IMAGE_ID instead of just REPO name. - How I did it Modified docker_img_ctl.j2 and docker makefiles. - How to verify it Run it on the switch.
This commit is contained in:
parent
6beba298b0
commit
1f7d9e2698
@ -31,7 +31,7 @@ function updateSyslogConf()
|
||||
{
|
||||
# On multiNPU platforms, change the syslog target ip to docker0 ip to allow logs from containers
|
||||
# running on the namespace to reach the rsyslog service running on the host
|
||||
# Also update the container name
|
||||
# Also update the container name
|
||||
if [[ ($NUM_ASIC -gt 1) ]]; then
|
||||
TARGET_IP=$(docker network inspect bridge --format={{ "'{{(index .IPAM.Config 0).Gateway}}'" }})
|
||||
CONTAINER_NAME="$DOCKERNAME"
|
||||
@ -380,9 +380,11 @@ start() {
|
||||
-e SX_API_SOCKET_FILE=/var/run/sx_sdk/sx_api.sock \
|
||||
-v /dev/shm:/dev/shm:rw \
|
||||
{%- else %}
|
||||
{%- if mount_default_tmpfs|default("n") == "y" %}
|
||||
--tmpfs /tmp \
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if sonic_asic_platform == "broadcom" %}
|
||||
{%- if docker_container_name == "syncd" %}
|
||||
-v /var/run/docker-syncd$DEV:/var/run/sswsyncd \
|
||||
@ -404,13 +406,23 @@ start() {
|
||||
$REDIS_MNT \
|
||||
-v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \
|
||||
{%- if sonic_asic_platform != "mellanox" %}
|
||||
{%- if mount_default_tmpfs|default("n") == "y" %}
|
||||
--tmpfs /tmp \
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if mount_default_tmpfs|default("n") == "y" %}
|
||||
--tmpfs /var/tmp \
|
||||
{%- endif %}
|
||||
--env "NAMESPACE_ID"="$DEV" \
|
||||
--env "NAMESPACE_PREFIX"="$NAMESPACE_PREFIX" \
|
||||
--env "NAMESPACE_COUNT"=$NUM_ASIC \
|
||||
--name=$DOCKERNAME {{docker_image_name}}:latest || {
|
||||
--name=$DOCKERNAME \
|
||||
{%- if docker_image_name is defined %}
|
||||
{{docker_image_name}}:latest \
|
||||
{%- else %}
|
||||
{{docker_image_id}} \
|
||||
{%- endif %}
|
||||
|| {
|
||||
echo "Failed to docker run" >&1
|
||||
exit 4
|
||||
}
|
||||
|
1
slave.mk
1
slave.mk
@ -931,6 +931,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
|
||||
export docker_image="$(docker)"
|
||||
export docker_image_name="$(basename $(docker))"
|
||||
export docker_container_name="$($(docker:-dbg.gz=.gz)_CONTAINER_NAME)"
|
||||
export mount_default_tmpfs="y"
|
||||
$(eval $(docker:-dbg.gz=.gz)_RUN_OPT += $($(docker:-dbg.gz=.gz)_$($*_IMAGE_TYPE)_RUN_OPT))
|
||||
export docker_image_run_opt="$($(docker:-dbg.gz=.gz)_RUN_OPT)"
|
||||
|
||||
|
Reference in New Issue
Block a user