work around https://github.com/docker/docker/issues/3631 by buffering stdout