Perform read right after subprocess for docker ps.

Perform read right after subprocess for docker ps.

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