summaryrefslogtreecommitdiffstats
path: root/jjb/opnfv/opnfv-docker.sh
diff options
context:
space:
mode:
Diffstat (limited to 'jjb/opnfv/opnfv-docker.sh')
-rw-r--r--jjb/opnfv/opnfv-docker.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/jjb/opnfv/opnfv-docker.sh b/jjb/opnfv/opnfv-docker.sh
index 6f0a0c35c..d65603fec 100644
--- a/jjb/opnfv/opnfv-docker.sh
+++ b/jjb/opnfv/opnfv-docker.sh
@@ -12,8 +12,18 @@ echo
# Remove previous running containers if exist
if [[ ! -z $(docker ps -a | grep $DOCKER_REPO_NAME) ]]; then
echo "Removing existing $DOCKER_REPO_NAME containers..."
- docker ps | grep $DOCKER_REPO_NAME | awk '{{print $1}}' | xargs docker stop
- docker ps -a | grep $DOCKER_REPO_NAME | awk '{{print $1}}' | xargs docker rm
+ #docker ps | grep $DOCKER_REPO_NAME | awk '{{print $1}}' | xargs docker stop
+ docker ps -a | grep $DOCKER_REPO_NAME | awk '{{print $1}}' | xargs docker rm -f
+ t=60
+ # Wait max 60 sec for containers to be removed
+ while [ $t -gt 0 ]; do
+ ids=$(docker ps | grep $DOCKER_REPO_NAME |awk '{{print $1}}')
+ if [[ -z $ids ]]; then
+ break
+ fi
+ sleep 1
+ let t=t-1
+ done
fi
@@ -24,7 +34,7 @@ if [[ ! -z $(docker images | grep $DOCKER_REPO_NAME) ]]; then
image_tags=($(docker images | grep $DOCKER_REPO_NAME | awk '{{print $2}}'))
for tag in "${{image_tags[@]}}"; do
echo "Removing docker image $DOCKER_REPO_NAME:$tag..."
- docker rmi $DOCKER_REPO_NAME:$tag
+ docker rmi -f $DOCKER_REPO_NAME:$tag
done
fi
@@ -36,7 +46,7 @@ if [[ "$UPDATE_LATEST_STABLE" == "true" ]]; then
echo "ERROR: The image $DOCKER_REPO_NAME with tag $STABLE_TAG does not exist."
exit 1
fi
- docker tag $DOCKER_REPO_NAME:$STABLE_TAG $DOCKER_REPO_NAME:latest_stable
+ docker tag -f $DOCKER_REPO_NAME:$STABLE_TAG $DOCKER_REPO_NAME:latest_stable
echo "Pushing $DOCKER_REPO_NAME:latest_stable ..."
docker push $DOCKER_REPO_NAME:latest_stable
exit 0