e2cc409f8a
- Create /var/run/redis/ folder on the host - Install Python client for Redis on the host - Mount /var/run/redis/ as read/write from host for all dockers - Enable accessing the database everywhere including on the host and from remote Signed-off-by: Shuotian Cheng <shuche@microsoft.com>
39 lines
987 B
Django/Jinja
39 lines
987 B
Django/Jinja
#!/bin/bash
|
|
|
|
# Obtain our platform and HWSKU as we will mount directories with these names in each docker
|
|
PLATFORM=`sonic-cfggen -v platform`
|
|
HWSKU=`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 {{docker_container_name}}
|
|
else
|
|
|
|
docker run -d {{docker_image_run_opt}} \
|
|
-v /var/run/redis:/var/run/redis:rw \
|
|
-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
|
|
}
|
|
|
|
attach() {
|
|
docker attach --no-stdin {{docker_container_name}}
|
|
}
|
|
|
|
stop() {
|
|
docker stop {{docker_container_name}}
|
|
}
|
|
|
|
case "$1" in
|
|
start|stop|attach)
|
|
$1
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|attach}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|