From 8a8857374c9ec3c858a8a99bcbeefce63bc2388c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 10 Oct 2018 22:03:44 -0400 Subject: [PATCH] fix: handle case where container being removed does not exist --- common-functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common-functions b/common-functions index c5bd0bb..02470a5 100755 --- a/common-functions +++ b/common-functions @@ -279,9 +279,12 @@ service_container_rm() { local SERVICE_NAME="$(get_service_name "$SERVICE")" service_stop "$SERVICE" + local ID=$(docker inspect "$SERVICE_NAME" -f '{{ .ID }}' 2> /dev/null || true) + [[ -z "$ID" ]] && return 0 + dokku_log_verbose_quiet "Removing container" if ! docker rm "$SERVICE_NAME" > /dev/null 2>&1; then - dokku_log_fail "Unable to remove container for service $SERVICE" + dokku_log_fail "Unable to remove container for service $SERVICE" fi }