summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-06-19 19:03:09 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-06-19 19:03:09 +0000
commit9d61623494f741ed26610da467e3400303b021a7 (patch)
tree4e4caab91630edc18412d63884933f97cb2eff1f
parent98d97f17351c86f81f0139df4038294aed1a50e7 (diff)
downloadjenkins-scripts-9d61623494f741ed26610da467e3400303b021a7.tar.gz
tcwg-start-container.sh: Restart stopped or restarting containers
Change-Id: Ib1b426dd043cb3a1899205456c8ce2c77f667528
-rwxr-xr-xtcwg-start-container.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/tcwg-start-container.sh b/tcwg-start-container.sh
index 16981e25..e33a4bb7 100755
--- a/tcwg-start-container.sh
+++ b/tcwg-start-container.sh
@@ -21,9 +21,10 @@ docker pull "$image"
rm_cnt=""
if docker stats --no-stream "$container" >/dev/null 2>&1; then
- case "$keep_existing" in
- true) exit 0 ;;
- keep_if_same_image)
+ running=$(docker container inspect -f "{{.State.Running}}" "$container")
+ case "$running:$keep_existing" in
+ true:true) exit 0 ;;
+ true:keep_if_same_image)
old_image=$(docker container inspect -f "{{.Image}}" "$container")
new_image=$(docker image inspect -f "{{.Id}}" "$image")
if [ x"$old_image" = x"$new_image" ]; then