Boyuan Yan | ed2ea357 | 2019-04-02 15:38:42 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # remove existed onos and atomix containers and images, stop emulator containers |
| 4 | containers=(`docker ps -a | grep -E 'onos-|atomix-|emulator' | awk '{print $1}'`) |
| 5 | if [[ ${#containers} != 0 ]]; then |
| 6 | for var in ${containers[*]}; do |
| 7 | docker stop ${var} & |
| 8 | done |
| 9 | wait |
| 10 | else |
| 11 | echo "There is no container existed." |
| 12 | fi |
| 13 | if [[ $# != 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 |
| 29 | else |
| 30 | echo "There is no container and image to be removed." |
| 31 | fi |