1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

B #6012: Clean func for docker images 6012 (#2390)

This commit is contained in:
Daniel Boca 2022-12-02 10:54:33 +01:00 committed by GitHub
parent 673e651639
commit 8942bcf659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,14 +49,19 @@ CONTEXT_PATH="$SHARE_LOCATION/context"
DOCKERFILES="$SHARE_LOCATION/dockerhub/dockerfiles"
DOCKERFILE="$SHARE_LOCATION/dockerhub"
#Docker image name for deletion
image_name=$(echo "$MARKET_URL" | cut -d "/" -f3 | cut -d "?" -f1)
#-------------------------------------------------------------------------------
# This function takes care of removing all temporary directories in case
# something fails
#-------------------------------------------------------------------------------
function clean {
docker rm -f "$container_id" > /dev/null 2>&1 || true
docker rmi $(docker images -q) -f
docker rmi -f $image_name
docker image rm -f one"$sid" > /dev/null 2>&1
rm -rf "$dockerdir"
}