blob: edb640dc652e5820e8370b2a09f1e02f4e43beeb [file] [log] [blame]
Boyuan Yaned2ea3572019-04-02 15:38:42 -07001#!/bin/bash
2
3# remove existed onos and atomix containers and images, stop emulator containers
4containers=(`docker ps -a | grep -E 'onos-|atomix-|emulator' | awk '{print $1}'`)
5if [[ ${#containers} != 0 ]]; then
6 for var in ${containers[*]}; do
7 docker stop ${var} &
8 done
9 wait
10else
11 echo "There is no container existed."
12fi
13if [[ $# != 1 || "$1" != "stop-docker" ]]; then
14 if [[ ${#containers} != 0 ]]; then
15 for var in ${containers[*]}; do
16 docker rm ${var} &
17 done
18 wait
19 fi
20 images=(`docker images | grep -e onos -e none -e "<none>" | awk '{print $3}'`)
21 if [[ ${#images} != 0 ]]; then
22 for var in ${images[*]}; do
23 docker rmi ${var} &
24 done
25 wait
26 else
27 echo "There is no onos/atomix docker image existed."
28 fi
29else
30 echo "There is no container and image to be removed."
31fi