Only perform docker validation once for tests

Review: https://reviews.apache.org/r/25569
Refactor Environment validation