fix: handle case where container being removed does not exist

This commit is contained in:
Jose Diaz-Gonzalez
2018-10-10 22:03:44 -04:00
parent 2176ab836e
commit 8a8857374c

View File

@@ -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
}