diff --git a/plugins/checks/check-deploy b/plugins/checks/check-deploy index 55d9b0bf5..4871b03b8 100755 --- a/plugins/checks/check-deploy +++ b/plugins/checks/check-deploy @@ -95,7 +95,8 @@ if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]]; dokku_log_info1 "Waiting for $DOKKU_DEFAULT_WAIT seconds ..." sleep $DOKKU_DEFAULT_WAIT - docker top "$DOKKU_APP_CONTAINER_ID" &>/dev/null || dokku_log_fail "App container failed to start!!" + DOKKU_APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$DOKKU_APP_CONTAINER_ID" || true) + [[ "$DOKKU_APP_CONTAINER_STATUS" != "true" ]] && dokku_log_fail "App container failed to start!!" dokku_log_info1 "Default container check successful!" && exit 0 fi diff --git a/plugins/ps/commands b/plugins/ps/commands index f5b824643..ca467c514 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -23,7 +23,8 @@ case "$1" in APP="$2"; CONTAINER_IDS=( $(get_container_ids $APP) ) ! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0 - if [[ "$(docker ps -q --no-trunc| grep -q ${CONTAINER_IDS[0]}; echo $?)" != "0" ]]; then + DOKKU_APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "${CONTAINER_IDS[0]}" || true) + if [[ "$DOKKU_APP_CONTAINER_STATUS" != "true" ]]; then release_and_deploy $APP else echo "App $APP already running" @@ -37,12 +38,14 @@ case "$1" in APP="$2"; CONTAINER_IDS=$(get_container_ids $APP) ! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0 - CONTAINER_IDS_EGREP_PATTERN=$(echo $CONTAINER_IDS | xargs | sed -e "s: :|:g") - if [[ "$(docker ps -q --no-trunc| egrep -q $CONTAINER_IDS_EGREP_PATTERN; echo $?)" = "0" ]]; then + for CID in $CONTAINER_IDS;do + DOKKU_APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true) + [[ "$DOKKU_APP_CONTAINER_STATUS" == "true" ]] && DOKKU_APP_RUNNING_CONTAINER_IDS+="$CID " + done + + if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then echo "Stopping $APP ..." - for CID in $CONTAINER_IDS;do - docker stop $CID > /dev/null - done + docker stop $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true else echo "App $APP already stopped" fi