2 ##############################################################################
3 # Copyright (c) 2016 ZTE and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 # Remove previous running containers if exist
10 if [[ ! -z $(docker ps -a | grep opnfv/qtip) ]]; then
11 echo "Removing existing opnfv/qtip containers..."
12 # workaround: sometimes it throws an error when stopping qtip container.
13 # To make sure ci job unblocked, remove qtip container by force without stopping it.
14 docker rm -f $(docker ps -a | grep opnfv/qtip | awk '{print $1}')
17 # Remove existing images if exist
18 if [[ ! -z $(docker images | grep opnfv/qtip) ]]; then
19 echo "Docker images to remove:"
20 docker images | head -1 && docker images | grep opnfv/qtip
21 image_tags=($(docker images | grep opnfv/qtip | awk '{print $2}'))
22 for tag in "${image_tags[@]}"; do
23 echo "Removing docker image opnfv/qtip:$tag..."
24 docker rmi opnfv/qtip:$tag