2 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
4 echo "Cleaning up docker containers/images..."
5 # Remove previous running containers if exist
6 if [[ ! -z $(docker ps -a | grep opnfv/dovetail) ]]; then
7 echo "Removing existing opnfv/dovetail containers..."
8 docker ps -a | grep opnfv/dovetail | awk '{print $1}' | xargs docker rm -f >$redirect
11 # Remove existing images if exist
12 if [[ ! -z $(docker images | grep opnfv/dovetail) ]]; then
13 echo "Docker images to remove:"
14 docker images | head -1 && docker images | grep opnfv/dovetail
15 image_tags=($(docker images | grep opnfv/dovetail | awk '{print $2}'))
16 for tag in "${image_tags[@]}"; do
17 echo "Removing docker image opnfv/dovetail:$tag..."
18 docker rmi opnfv/dovetail:$tag >$redirect