Source:
private void tryStart() { try { String dockerImageName = image.get(); logger().debug("Starting container: {}", dockerImageName); logger().info("Creating container for image: {}", dockerImageName); CreateContainerCmd createCommand = dockerClient.createContainerCmd(dockerImageName); applyConfiguration(createCommand); containerId = createCommand.exec().getId(); connectToPortForwardingNetwork(createCommand.getNetworkMode()); copyToFileContainerPathMap.forEach(this::copyFileToContainer); containerIsCreated(containerId); logger().info("Starting container with ID: {}", containerId); dockerClient.startContainerCmd(containerId).exec(); logger().info("Container is starting: {}", dockerImageName, containerId); this.logConsumers.forEach(this::followOutput); containerInfo = dockerClient.inspectContainerCmd(containerId).exec(); containerName = containerInfo.getName(); containerIsStarting(containerInfo); if (!this.startupCheckStrategy.waitUntilStartupSuccessful(dockerClient, containerId)) { throw new IllegalStateException("Container did not start correctly."); } waitUntilContainerStarted(); logger().info("Container started", dockerImageName); containerIsStarted(containerInfo); } catch (Exception e) { logger().error("Could not start container", e); if (containerId != null) { logger().error("Container log output (if any) will follow:"); FrameConsumerResultCallback resultCallback = new FrameConsumerResultCallback(); resultCallback.addConsumer(STDOUT, new Slf4jLogConsumer(logger())); resultCallback.addConsumer(STDERR, new Slf4jLogConsumer(logger())); dockerClient.logContainerCmd(containerId).withStdOut(true).withStdErr(true).exec(resultCallback); try { resultCallback.getCompletionLatch().await(1, TimeUnit.MINUTES); } catch (InterruptedException ignored) { } } throw new ContainerLaunchException("Could not create/start container", e); } }

Target:
private void tryStart() { try { String dockerImageName = image.get(); logger().debug("Starting container: {}", dockerImageName); logger().info("Creating container for image: {}", dockerImageName); CreateContainerCmd createCommand = dockerClient.createContainerCmd(dockerImageName); applyConfiguration(createCommand); containerId = createCommand.exec().getId(); connectToPortForwardingNetwork(createCommand.getNetworkMode()); copyToFileContainerPathMap.forEach(this::copyFileToContainer); containerIsCreated(containerId); logger().info("Starting container with ID: {}", containerId); dockerClient.startContainerCmd(containerId).exec(); logger().info("Container is starting: {}", dockerImageName, containerId); this.logConsumers.forEach(this::followOutput); containerInfo = dockerClient.inspectContainerCmd(containerId).exec(); containerName = containerInfo.getName(); containerIsStarting(containerInfo); if (!this.startupCheckStrategy.waitUntilStartupSuccessful(dockerClient, containerId)) { throw new IllegalStateException("Container did not start correctly."); } waitUntilContainerStarted(); logger().info("Container started", dockerImageName); containerIsStarted(containerInfo); } catch (Exception e) { logger().error("Could not start container", e); if (containerId != null) { final String containerLogs = getLogs(); if (containerLogs.length() > 0) { logger().error("Log output from the failed container:\n{}", getLogs()); } else { logger().error("There are no stdout/stderr logs available for the failed container"); } } throw new ContainerLaunchException("Could not create/start container", e); } }