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 66e8279dca
commit d470ade7a7

View File

@@ -279,6 +279,9 @@ service_container_rm() {
local SERVICE_NAME="$(get_service_name "$SERVICE")" local SERVICE_NAME="$(get_service_name "$SERVICE")"
service_stop "$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" dokku_log_verbose_quiet "Removing container"
if ! docker rm "$SERVICE_NAME" > /dev/null 2>&1; then 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"