diff --git a/tests/tox.sh b/tests/tox.sh index 8a79603fe..970e343c0 100644 --- a/tests/tox.sh +++ b/tests/tox.sh @@ -48,7 +48,12 @@ bash "$WORKSPACE"/travis-builds/purge_cluster.sh containers_to_remove=$(docker ps -a -q) if [ "${containers_to_remove}" ]; then - docker rm -f "$@" "${containers_to_remove}" || echo failed to remove containers + ATTEMPTS=0 + until [ $ATTEMPTS -eq 5 ] || [ $NUM_CONTAINERS -eq 0 ]; do + docker rm -f "$@" "${containers_to_remove}" + $(( ATTEMPTS++ )) + NUM_CONTAINERS=$(docker ps -a -q | wc -l) + done fi cd "$WORKSPACE"