From 85b41121de33bb35ae576b68df6461a95894bc9e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 1 Aug 2019 18:28:44 -0400 Subject: [PATCH] fix: make image removal synchronous Asynchronous image removal would remove intermediate build images during the build process, causing intermittent build failures for users of multi-stage dockerfiles. While we still remove intermediate docker images that may be used in the current build, we now do so during the deploy, ensuring that there are no intermediate build failures in the future. Closes #3474 --- plugins/common/functions | 8 ++++---- plugins/scheduler-docker-local/scheduler-docker-cleanup | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/common/functions b/plugins/common/functions index b38e88130..694152140 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -633,10 +633,10 @@ docker_cleanup() { # delete danging images # shellcheck disable=SC2046 - "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -f "label=com.dokku.app-name=$APP" -q) &>/dev/null & + "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -f "label=com.dokku.app-name=$APP" -q) &>/dev/null || true # delete unused images - docker image prune --all --filter "label=com.dokku.app-name=$APP" &>/dev/null & + "$DOCKER_BIN" image prune --all --filter "label=com.dokku.app-name=$APP" &>/dev/null || true else # delete all non-running containers # shellcheck disable=SC2046 @@ -648,10 +648,10 @@ docker_cleanup() { # delete danging images # shellcheck disable=SC2046 - "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -q) &>/dev/null & + "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -q) &>/dev/null || true # delete unused images - docker image prune --all &>/dev/null & + "$DOCKER_BIN" image prune --all &>/dev/null || true fi } diff --git a/plugins/scheduler-docker-local/scheduler-docker-cleanup b/plugins/scheduler-docker-local/scheduler-docker-cleanup index e47bc9d9b..4564969a9 100755 --- a/plugins/scheduler-docker-local/scheduler-docker-cleanup +++ b/plugins/scheduler-docker-local/scheduler-docker-cleanup @@ -23,10 +23,10 @@ scheduler-docker-local-scheduler-docker-cleanup() { # delete danging images # shellcheck disable=SC2046 - "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -f "label=com.dokku.app-name=$APP" -q) &>/dev/null & + "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -f "label=com.dokku.app-name=$APP" -q) &>/dev/null || true # delete unused images - docker image prune --all --filter "label=com.dokku.app-name=$APP" &>/dev/null & + "$DOCKER_BIN" image prune --all --filter "label=com.dokku.app-name=$APP" &>/dev/null || true else # delete all non-running containers # shellcheck disable=SC2046 @@ -38,10 +38,10 @@ scheduler-docker-local-scheduler-docker-cleanup() { # delete danging images # shellcheck disable=SC2046 - "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -q) &>/dev/null & + "$DOCKER_BIN" rmi $("$DOCKER_BIN" images -f 'dangling=true' -q) &>/dev/null || true # delete unused images - docker image prune --all &>/dev/null & + "$DOCKER_BIN" image prune --all &>/dev/null || true fi }