From d561c5be0004dc23c341a7c632e54098ee9a2ac8 Mon Sep 17 00:00:00 2001 From: Taka Date: Fri, 27 Mar 2020 20:47:11 +0000 Subject: [PATCH] Handle errors when building the Docker container correctly. --- run-container.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/run-container.sh b/run-container.sh index 1ac59a1..bd3bb44 100755 --- a/run-container.sh +++ b/run-container.sh @@ -108,15 +108,15 @@ fi # build the container if [ -z "$NO_BUILD" ]; then - echo Building the container... + echo Building the \"$TAG\" container... docker build . --tag vasl-templates:$TAG 2>&1 \ | sed -e 's/^/ /' - if [ $? -ne 0 ]; then exit 10 ; fi + if [ ${PIPESTATUS[0]} -ne 0 ]; then exit 10 ; fi echo fi # launch the container -echo Launching the container... +echo Launching the \"$TAG\" container... docker run \ --publish $PORT:5010 \ --name vasl-templates \ @@ -127,3 +127,4 @@ docker run \ vasl-templates:$TAG \ 2>&1 \ | sed -e 's/^/ /' +exit ${PIPESTATUS[0]}