Change-Id: Ib8d3db4c5f5d181e30a009fc928fb6fbe12b131b
# Cleanup
# Make sure all test containers are stopped and removed when tests are finished
-docker stop $(docker ps -a -q)
-docker rm $(docker ps -a -q)
\ No newline at end of file
+DOCKER_CONTAINERS=$(sudo docker ps -a -q 2> /dev/null)
+if [ -n "${DOCKER_CONTAINERS}" ]; then
+ docker stop ${DOCKER_CONTAINERS} > /dev/null
+ echo -e "Removing containers with ID:"
+ docker rm ${DOCKER_CONTAINERS}
+fi
+
# Cleanup
# Make sure all test containers are stopped and removed when tests are finished
-docker stop $(docker ps -a -q)
-docker rm $(docker ps -a -q)
\ No newline at end of file
+DOCKER_CONTAINERS=$(sudo docker ps -a -q 2> /dev/null)
+if [ -n "${DOCKER_CONTAINERS}" ]; then
+ docker stop ${DOCKER_CONTAINERS} > /dev/null
+ echo -e "Removing containers with ID:"
+ docker rm ${DOCKER_CONTAINERS}
+fi
+