public void startContainer(InstanceStartRequest request, InstanceStartResponse response) {
    logger.info(String.format("begin startContainer: %s", request));

    try {
      // 1. create cmd
      StartContainerCmd startContainerCmd =
          dockerClient.startContainerCmd(request.getContainerId());

      // 2. invoke post processor before start container
      StartContainerContext startContainerContext =
          buildStartContainerContext(request, startContainerCmd);
      applyStartContainerProcessorsBeforeStart(startContainerContext);

      // 3. exec cmd
      startContainerCmd.exec();

      // 4. invoke post processor after start container
      applyStartContainerProcessorsAfterStart(startContainerContext);

      response.success();
    } catch (Exception e) {
      response.fail(e.toString());
      logger.error(String.format("error startContainer: %s", request), e);
    }

    logger.info(String.format("end startContainer: %s", response));
  }
  public boolean createContainer(InstanceStartRequest request, InstanceStartResponse response) {
    logger.info(String.format("begin createContainer: %s", request));

    String imageId = request.getImageId();
    String containerId;
    try {
      // 1. create cmd
      CreateContainerCmd containerCmd = dockerClient.createContainerCmd(imageId);

      // 2. invoke post processor before create container
      CreateContainerContext createContainerContext =
          buildCreateContainerContext(request, containerCmd);
      applyCreateContainerProcessorsBeforeCreate(createContainerContext);

      // 3. exec cmd
      CreateContainerResponse createContainerResponse = containerCmd.exec();

      // 4. invoke post processor after create container
      applyCreateContainerProcessorsAfterCreate(createContainerContext);

      containerId = createContainerResponse.getId();
      request.setContainerId(containerId);

      if (containerId == null) {
        response.fail("create container failed, created containerId is null!");
      } else {
        response.success();
      }
    } catch (Exception e) {
      response.fail(e.toString());
      logger.error(String.format("error createContainer: %s", request), e);
    }

    logger.info(String.format("end createContainer: %s", response));

    return response.isSuccess();
  }