use docker inspect instead of docker ps grep pattern. closes #1281
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user