From 7d74359c647fd8950d3f7f28fcc6e49c5587e0f6 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Thu, 16 Feb 2017 17:25:08 +0100 Subject: [docker] Use image IDs instead of tags If we use tags, when there are remaining images without the tag it fails and get the following error: Removing docker image opnfv/functest:... Error response from daemon: Error parsing reference: "opnfv/functest:" is not a valid repository/tag By using IDs we make sure we delete the images. Change-Id: Ib336dc73168bac909c42dd4a9681ef07d477dc7b Signed-off-by: jose.lausuch --- jjb/releng/opnfv-docker.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jjb/releng/opnfv-docker.sh b/jjb/releng/opnfv-docker.sh index c906e1fcd..7b93d50bf 100644 --- a/jjb/releng/opnfv-docker.sh +++ b/jjb/releng/opnfv-docker.sh @@ -43,11 +43,11 @@ fi if [[ -n "$(docker images | grep $DOCKER_REPO_NAME)" ]]; then echo "Docker images to remove:" docker images | head -1 && docker images | grep $DOCKER_REPO_NAME - image_tags=($(docker images | grep $DOCKER_REPO_NAME | awk '{print $2}')) - for tag in "${image_tags[@]}"; do - if [[ -n "$(docker images|grep $DOCKER_REPO_NAME|grep $tag)" ]]; then - echo "Removing docker image $DOCKER_REPO_NAME:$tag..." - docker rmi -f $DOCKER_REPO_NAME:$tag + image_ids=($(docker images | grep $DOCKER_REPO_NAME | awk '{print $3}')) + for id in "${image_ids[@]}"; do + if [[ -n "$(docker images|grep $DOCKER_REPO_NAME|grep $id)" ]]; then + echo "Removing docker image $DOCKER_REPO_NAME:$id..." + docker rmi -f $id fi done fi -- cgit 1.2.3-korg