Skip to content

Commit 8a9182c

Browse files
committed
Don't fail if CONTAINER is inexistant.
1 parent e42c028 commit 8a9182c

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

‎dokku‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ case "$1" in
5252
pluginhook pre-deploy $APP $IMAGE
5353

5454
# kill the app when running
55-
if [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
55+
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
5656
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
5757
docker kill $oldid > /dev/null
5858
fi

‎plugins/00_dokku-standard/commands‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ case "$1" in
1313
fi
1414

1515
pluginhook pre-delete $APP
16-
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
16+
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
17+
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
18+
19+
docker stop $ID > /dev/null
20+
docker rm $ID > /dev/null
21+
fi
1722

18-
docker stop $ID > /dev/null
1923
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
20-
docker rm $ID > /dev/null
2124

2225
pluginhook post-delete $APP
2326
;;
@@ -33,10 +36,14 @@ case "$1" in
3336
exit 1
3437
fi
3538

36-
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
37-
docker logs $CONTAINER | tail -n 100
38-
if [[ $3 == "-t" ]]; then
39-
docker attach $CONTAINER
39+
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
40+
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
41+
docker logs $CONTAINER | tail -n 100
42+
if [[ $3 == "-t" ]]; then
43+
docker attach $CONTAINER
44+
fi
45+
else
46+
echo "Application's container not found"
4047
fi
4148
;;
4249

‎plugins/config/commands‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ case "$1" in
108108
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
109109
ENV_ADD=""
110110
ENV_TEMP=`cat "${ENV_FILE}"`
111-
ID=$(< "$APP_DIR/CONTAINER")
112111
RESTART=false
113112
VARS="${*:3}"
114113

@@ -151,7 +150,6 @@ case "$1" in
151150

152151
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
153152
ENV_TEMP=`cat "${ENV_FILE}"`
154-
ID=$(< "$APP_DIR/CONTAINER")
155153
VARS="${*:3}"
156154

157155
for var in $VARS; do

0 commit comments

Comments
 (0)