@Override
  public void before() throws Exception { //runDockerContainer
    runCmdAndPrintStreams(buildRmCmd(), 600);
    if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
      printDockerEvents();
      throw new RuntimeException("Unable to start docker container");
    }
    long startTime = System.currentTimeMillis();
    ProcessResults pr;
    do {
      Thread.sleep(1000);
      pr = runCmdAndPrintStreams(buildLogCmd(), 30);
      if (pr.rc != 0) {
        printDockerEvents();
        throw new RuntimeException("Failed to get docker logs");
      }
    } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
    if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
      printDockerEvents();
      throw new RuntimeException(
          String.format("Container initialization failed within %d seconds. Please check the hive logs.",
              MAX_STARTUP_WAIT / 1000));
    }
    MetastoreSchemaTool.setHomeDirForTesting();
  }
Determine if the docker container is ready to use.

@param pr output of docker logs command
@return true if ready, false otherwise
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/dbinstall/rules/DatabaseRule.java