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
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user