1
0
mirror of https://github.com/stucki/docker-lineageos synced 2024-12-19 17:12:29 -05:00

Merge pull request #36 from stucki/ignore-error

Continue if "docker inspect" returns false
This commit is contained in:
Michael Stucki 2017-04-24 22:57:57 +02:00 committed by GitHub
commit ef3cc04310

4
run.sh
View File

@ -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 . docker build -t $REPOSITORY:$TAG --build-arg hostuid=$USERID --build-arg hostgid=$GROUPID .
# After successful build, delete existing containers # 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 if [[ -n $IS_EXISTING ]]; then
docker rm $CONTAINER docker rm $CONTAINER
fi fi
@ -57,7 +57,7 @@ fi
# With the given name $CONTAINER, reconnect to running container, start # With the given name $CONTAINER, reconnect to running container, start
# an existing/stopped container or run a new one if one does not exist. # 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 if [[ $IS_RUNNING == "true" ]]; then
docker attach $CONTAINER docker attach $CONTAINER
elif [[ $IS_RUNNING == "false" ]]; then elif [[ $IS_RUNNING == "false" ]]; then