Don't fail if CONTAINER is inexistant.

This commit is contained in:
Paul Lietar
2013-11-21 21:15:13 +00:00
parent e42c028d18
commit 8a9182c859
3 changed files with 15 additions and 10 deletions

2
dokku
View File

@@ -52,7 +52,7 @@ case "$1" in
pluginhook pre-deploy $APP $IMAGE
# kill the app when running
if [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker kill $oldid > /dev/null
fi

View File

@@ -13,11 +13,14 @@ case "$1" in
fi
pluginhook pre-delete $APP
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker stop $ID > /dev/null
docker rm $ID > /dev/null
fi
docker stop $ID > /dev/null
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
docker rm $ID > /dev/null
pluginhook post-delete $APP
;;
@@ -33,10 +36,14 @@ case "$1" in
exit 1
fi
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
docker logs $CONTAINER | tail -n 100
if [[ $3 == "-t" ]]; then
docker attach $CONTAINER
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
docker logs $CONTAINER | tail -n 100
if [[ $3 == "-t" ]]; then
docker attach $CONTAINER
fi
else
echo "Application's container not found"
fi
;;

View File

@@ -108,7 +108,6 @@ case "$1" in
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
ENV_ADD=""
ENV_TEMP=`cat "${ENV_FILE}"`
ID=$(< "$APP_DIR/CONTAINER")
RESTART=false
VARS="${*:3}"
@@ -151,7 +150,6 @@ case "$1" in
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
ENV_TEMP=`cat "${ENV_FILE}"`
ID=$(< "$APP_DIR/CONTAINER")
VARS="${*:3}"
for var in $VARS; do