diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2020-06-22 10:36:19 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2020-06-22 10:36:19 +0000 |
commit | f760960848ba929a3170a0a21c4f68154c3e16db (patch) | |
tree | 3c94964cca5d52e6ec8506aa9e2de9d910d9248a | |
parent | ce024e90e6ec65f7460082778d41180b742f5305 (diff) |
tcwg-start-container.sh: Handle containers stuck in restart loop
Change-Id: I6e32f290ba92449905ca0c215ec13d0384ada938
-rwxr-xr-x | tcwg-start-container.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tcwg-start-container.sh b/tcwg-start-container.sh index c9929eec..5917e834 100755 --- a/tcwg-start-container.sh +++ b/tcwg-start-container.sh @@ -34,7 +34,15 @@ if docker stats --no-stream "$container" >/dev/null 2>&1; then esac # Rename the current container to free-up the name for "docker run" below. rm_cnt="$container.bak" - docker rename "$container" "$rm_cnt" + docker rename "$container" "$rm_cnt" & + res=0 && wait $! || res=$? + if [ x"$res" != x"0" ]; then + # Failure to rename a container is usually caused by container + # restarting loop. This restarting container can't be the current + # one, so just delete it. + docker rm -vf "$container" + rm_cnt="" + fi fi start_sh=$(mktemp) |