diff options
-rwxr-xr-x | tcwg-start-container.sh | 7 |
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 |