code: public void waitForExit() throws InterruptedException {
          try {
              dockerClient.waitContainer(container.id());
          } catch (DockerException e) {
              throw new IllegalStateException(e);
          }
      }
docs: Block until container exit.