diff --git a/docker/scripts/dev_start.sh b/docker/scripts/dev_start.sh index 8d13c5c9462..4fb4722a11c 100755 --- a/docker/scripts/dev_start.sh +++ b/docker/scripts/dev_start.sh @@ -59,10 +59,29 @@ OPTIONS: -h, --help Display this help and exit. -t, --tag Specify which version of a docker image to pull. -l, --local Use local docker image. + stop Stop all running Apollo containers. EOF exit 0 } +function stop_containers() +{ +running_containers=$(docker ps --format "{{.Names}}") + +for i in ${running_containers[*]} +do + if [[ "$i" =~ apollo_* ]];then + printf %-*s 70 "stopping container: $i ..." + docker stop $i > /dev/null + if [ $? -eq 0 ];then + printf "\033[32m[DONE]\033[0m\n" + else + printf "\033[31m[FAILED]\033[0m\n" + fi + fi +done +} + APOLLO_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )" if [ ! -e /apollo ]; then @@ -118,7 +137,11 @@ do shift source ${APOLLO_ROOT_DIR}/docker/scripts/restart_map_volume.sh \ "${map_name}" "${VOLUME_VERSION}" - ;; + ;; + stop) + stop_containers + exit 0 + ;; *) echo -e "\033[93mWarning\033[0m: Unknown option: $1" exit 2