#!/bin/bash # Obtain our platform and HWSKU as we will mount directories with these names in each docker PLATFORM=`/usr/bin/sonic-cfggen -v platform` HWSKU=`/usr/bin/sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` start() { docker inspect --type container {{docker_container_name}} &>/dev/null if [ "$?" -eq "0" ]; then docker start -a {{docker_container_name}} else docker run {{docker_image_run_opt}} \ -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ --name={{docker_container_name}} {{docker_image_name}} fi } stop() { docker stop {{docker_container_name}} } case "$1" in start|stop) $1 ;; *) echo "Usage: $0 {start|stop}" exit 1 ;; esac