public Long loggingExecForService(String serviceName, String... command) {
    ContainerState container = composeContainer.getContainerByServiceName(serviceName + "_1")
        .orElseThrow(() -> new IllegalArgumentException("Unknown service name: " + serviceName));

    String containerId = container.getContainerId();
    String containerName = container.getContainerInfo().getName();

    logger.info("{}: Running 'exec' command: {}", containerName, command);

    DockerClient dockerClient = DockerClientFactory.instance().client();

    final ExecCreateCmdResponse execCreateCmdResponse = dockerClient.execCreateCmd(containerId)
        .withAttachStdout(true).withAttachStderr(true).withCmd(command).exec();

    final ToLogConsumer stdoutConsumer = new ToLogConsumer(serviceName, logger);
    final ToLogConsumer stderrConsumer = new ToLogConsumer(serviceName, logger);

    FrameConsumerResultCallback callback = new FrameConsumerResultCallback();
    callback.addConsumer(OutputFrame.OutputType.STDOUT, stdoutConsumer);
    callback.addConsumer(OutputFrame.OutputType.STDERR, stderrConsumer);

    try {
      dockerClient.execStartCmd(execCreateCmdResponse.getId()).exec(callback).awaitCompletion();
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }

    return dockerClient.inspectExecCmd(execCreateCmdResponse.getId()).exec().getExitCodeLong();
  }
Execute a command in a service container, logging the output

@return the exit code of the command
geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java