mirror of
https://github.com/dokku/dokku.git
synced 2026-02-23 19:50:34 +01:00
feat: use is_container_status everywhere
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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")"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user