Fixed docker validation and only run docker tests on linux with root.

Review: https://reviews.apache.org/r/24361