docker: make sure to cleanup containers before force exit

Observed containers were being left over on the host machine when
docker tests were terminated mid way. Due to this, host machine was not
able to run anymore containers after a certain threshold of running
containers and eventually runs out of available memory. Fix this issue
by always cleaning the containers when exiting from the tests.

Change-Id: I6f69228743f38762698d71352ac1d22651696ee5
diff --git a/test/docker/run.sh b/test/docker/run.sh
index c5af6e1..e095454 100755
--- a/test/docker/run.sh
+++ b/test/docker/run.sh
@@ -88,8 +88,7 @@
     usage "$MISSING, did you forget --depends-on-plugin-jar?"
 fi
 [ -n "$GERRIT_WAR" ] && cp -f "$GERRIT_WAR" "$ARTIFACTS/gerrit.war"
-progress "Building docker images" build_images
-run_depends_on_plugin_tests ; RESULT=$?
-cleanup
-
-exit "$RESULT"
+( trap cleanup EXIT SIGTERM
+    progress "Building docker images" build_images
+    run_depends_on_plugin_tests
+)