@SneakyThrows(IOException.class)
    public String getOutput(DockerClient dockerClient, String containerId, OutputFrame.OutputType... types) {
        if (containerId == null) {
            return "";
        }

        if (types.length == 0) {
            types = new OutputFrame.OutputType[] { OutputFrame.OutputType.STDOUT, OutputFrame.OutputType.STDERR };
        }

        final ToStringConsumer consumer = new ToStringConsumer();
        final WaitingConsumer wait = new WaitingConsumer();
        try (Closeable closeable = attachConsumer(dockerClient, containerId, consumer.andThen(wait), false, types)) {
            wait.waitUntilEnd();
            return consumer.toUtf8String();
        }
    }
Retrieve all previous log outputs for a container of the specified type(s).

@param dockerClient a Docker client
@param containerId  container ID to attach to
@param types        types of {@link OutputFrame} to receive
@return all previous output frames (stdout/stderr being separated by newline characters)
core/src/main/java/org/testcontainers/utility/LogUtils.java