summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2020-05-18 10:00:29 +0100
committerDavid Spickett <david.spickett@linaro.org>2020-05-18 10:37:12 +0000
commitdcc16d9eaae5ba56f999e1dc2a101abf6ad92ca8 (patch)
treee7792d3e7c69a22b12456c28f38fd094d767c80d
parent14384c35a5d572f614fd950e176feb8247df18c4 (diff)
start-container-docker.sh: Only try to remove containers that exist
The current code is causing docker to print "ERROR <...>", which isn't an error for us and confuses the Jenkins log. Change-Id: I902bfb7ca66d781b23726785852381e41e4a76e4
-rwxr-xr-xstart-container-docker.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index e9ad734f..f13b7290 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -359,7 +359,8 @@ fi
# build can start writing to files of the current build.
if $bind_mounted_workspace; then
prev_container=$($SSH $session_host flock "$WORKSPACE/.lock" cat "$WORKSPACE/.lock" || true)
- if [ x"$prev_container" != x"" ]; then
+ # Container may have been cleaned up by something else
+ if [ x"$prev_container" != x"" ] && [ "$(docker ps -a | grep $prev_container)" ] ; then
echo "NOTE: Removing previous container for $WORKSPACE"
$DOCKER rm -vf "$prev_container" || echo "WARNING: Could not remove $prev_container"
fi