public static String executeDockerCommand(DockerCommand dockerCommand,
      String containerId, Map<String, String> env,
      PrivilegedOperationExecutor privilegedOperationExecutor,
      boolean disableFailureLogging, Context nmContext)
      throws ContainerExecutionException {
    PrivilegedOperation dockerOp = dockerCommand.preparePrivilegedOperation(
        dockerCommand, containerId, env, nmContext);

    if (disableFailureLogging) {
      dockerOp.disableFailureLogging();
    }
    LOG.debug("Running docker command: {}", dockerCommand);

    try {
      String result = privilegedOperationExecutor
          .executePrivilegedOperation(null, dockerOp, null,
              env, true, false);
      if (result != null && !result.isEmpty()) {
        result = result.trim();
      }
      return result;
    } catch (PrivilegedOperationException e) {
      throw new ContainerExecutionException("Docker operation failed",
          e.getExitCode(), e.getOutput(), e.getErrorOutput());
    }
  }
@Test
  public void testExecuteDockerLoad() throws Exception {
    DockerLoadCommand dockerCommand =
        new DockerLoadCommand(MOCK_LOCAL_IMAGE_NAME);
    DockerCommandExecutor.executeDockerCommand(dockerCommand, MOCK_CONTAINER_ID,
        env, mockExecutor, false, nmContext);
    List<PrivilegedOperation> ops = MockPrivilegedOperationCaptor
        .capturePrivilegedOperations(mockExecutor, 1, true);
    List<String> dockerCommands = getValidatedDockerCommands(ops);
    assertEquals(1, ops.size());
    assertEquals(PrivilegedOperation.OperationType.RUN_DOCKER_CMD.name(),
        ops.get(0).getOperationType().name());
    assertEquals(3, dockerCommands.size());
    assertEquals("[docker-command-execution]", dockerCommands.get(0));
    assertEquals("  docker-command=load", dockerCommands.get(1));
    assertEquals("  image=" + MOCK_LOCAL_IMAGE_NAME, dockerCommands.get(2));


  }