diff --git a/plugins/common/functions b/plugins/common/functions index 424a2ff7b..240bd215e 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -347,8 +347,7 @@ get_app_running_container_ids() { CIDS=$(get_app_container_ids "$APP" "$CONTAINER_TYPE") for CID in $CIDS; do - local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2>/dev/null || true) - [[ "$APP_CONTAINER_STATUS" == "true" ]] && local APP_RUNNING_CONTAINER_IDS+="$CID " + (is_container_status "$CID" "Running") && local APP_RUNNING_CONTAINER_IDS+="$CID " done echo "$APP_RUNNING_CONTAINER_IDS" diff --git a/plugins/enter/subcommands/default b/plugins/enter/subcommands/default index 0c2c50e29..cc9296d99 100755 --- a/plugins/enter/subcommands/default +++ b/plugins/enter/subcommands/default @@ -45,8 +45,7 @@ enter_default_cmd() { fi fi - docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist" - docker inspect -f '{{ .State.Running }}' "$ID" | grep -q "true" > /dev/null || dokku_log_fail "Container is not running" + (is_container_status "$ID" "Running") || dokku_log_fail "Container is not running" local DOKKU_APP_SHELL="/bin/bash" DOKKU_APP_SHELL="$(config_get --global DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")" diff --git a/plugins/ps/subcommands/report b/plugins/ps/subcommands/report index 7b9755701..0dafcdd33 100755 --- a/plugins/ps/subcommands/report +++ b/plugins/ps/subcommands/report @@ -13,8 +13,11 @@ report_single_app() { local APP_CIDS=$(get_app_container_ids "$APP"); local PROCS=0; local RUNNING="" for CID in $APP_CIDS; do - local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2> /dev/null || true) - if [[ "$APP_CONTAINER_STATUS" == "true" ]]; then RUNNING+="0"; else RUNNING+="1"; fi + if (is_container_status "$CID" "Running"); then + RUNNING+="0" + else + RUNNING+="1" + fi PROCS=$((PROCS + 1)) done