From 15db4220e669ab9cc373599e7320145d82cc43fb Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Mon, 24 Apr 2017 22:56:01 +0200 Subject: [PATCH] Continue if "docker inspect" returns false --- run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index 08c3434..a1eb166 100755 --- a/run.sh +++ b/run.sh @@ -49,7 +49,7 @@ elif [[ $FORCE_BUILD = 1 ]] || ! echo "$IMAGE_EXISTS" | grep -q "$TAG"; then docker build -t $REPOSITORY:$TAG --build-arg hostuid=$USERID --build-arg hostgid=$GROUPID . # After successful build, delete existing containers - IS_EXISTING=$(docker inspect -f '{{.Id}}' $CONTAINER 2>/dev/null) + IS_EXISTING=$(docker inspect -f '{{.Id}}' $CONTAINER 2>/dev/null) || true if [[ -n $IS_EXISTING ]]; then docker rm $CONTAINER fi @@ -57,7 +57,7 @@ fi # With the given name $CONTAINER, reconnect to running container, start # an existing/stopped container or run a new one if one does not exist. -IS_RUNNING=$(docker inspect -f '{{.State.Running}}' $CONTAINER 2>/dev/null) +IS_RUNNING=$(docker inspect -f '{{.State.Running}}' $CONTAINER 2>/dev/null) || true if [[ $IS_RUNNING == "true" ]]; then docker attach $CONTAINER elif [[ $IS_RUNNING == "false" ]]; then