diff --git a/pkg/container/api.go b/pkg/container/api.go index 050679771..7c25079d9 100644 --- a/pkg/container/api.go +++ b/pkg/container/api.go @@ -112,6 +112,11 @@ func (c *clientV1Alpha1) runAirship() error { if err != nil { return err } + defer func(container Container) { + if rmErr := container.RmContainer(); rmErr != nil { + log.Printf("Failed to remove container with id '%s', err is '%s'", container.GetID(), rmErr.Error()) + } + }(cont) // this will split the env vars into the ones to be exported and the ones that have values contEnv := runtimeutil.NewContainerEnvFromStringSlice(c.conf.Spec.EnvVars) diff --git a/tools/deployment/24_build_images.sh b/tools/deployment/24_build_images.sh index 5856a731a..f45ecfadd 100755 --- a/tools/deployment/24_build_images.sh +++ b/tools/deployment/24_build_images.sh @@ -37,9 +37,6 @@ done echo "List generated images" ls -lth ${IMAGE_DIR} -echo "Remove the container used for image generation" -sudo docker rm $(docker ps -a -f status=exited -q) - #cleanup the directories if [ "${CLEANUP_SERVE_DIR}" == "true" ] || [ "${CLEANUP_SERVE_DIR}" == "True" ]; then echo "Clean directories used by image-builder"