Source:
<code>private void tryStart(Profiler profiler) { try { String dockerImageName = image.get(); logger().debug("Starting container: {}", dockerImageName); logger().info("Creating container for image: {}", dockerImageName); profiler.start("Create container"); <START> HostConfig hostConfig = buildHostConfig(); <END> CreateContainerCmd createCommand = dockerClient.createContainerCmd(dockerImageName) .withHostConfig(hostConfig); applyConfiguration(createCommand); containerId = createCommand.exec().getId(); connectToPortForwardingNetwork(createCommand.getNetworkMode()); copyToFileContainerPathMap.forEach(this::copyFileToContainer); containerIsCreated(containerId); logger().info("Starting container with ID: {}", containerId); profiler.start("Start container"); dockerClient.startContainerCmd(containerId).exec(); this.logConsumers.forEach(this::followOutput); logger().info("Container is starting: {}", dockerImageName, containerId); profiler.start("Inspecting container"); containerInfo = dockerClient.inspectContainerCmd(containerId).exec(); containerName = containerInfo.getName(); profiler.start("Call containerIsStarting on subclasses"); containerIsStarting(containerInfo); profiler.start("Wait until container has started properly, or there's evidence it failed to start."); if (!this.startupCheckStrategy.waitUntilStartupSuccessful(dockerClient, containerId)) { throw new IllegalStateException("Container did not start correctly."); } profiler.start("Wait until container started properly"); 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); } finally { profiler.stop(); } }</code><technical_language>please move applyConfiguration</technical_language>

Target:
private void tryStart(Profiler profiler) { try { String dockerImageName = image.get(); logger().debug("Starting container: {}", dockerImageName); logger().info("Creating container for image: {}", dockerImageName); profiler.start("Create container"); 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); profiler.start("Start container"); dockerClient.startContainerCmd(containerId).exec(); this.logConsumers.forEach(this::followOutput); logger().info("Container is starting: {}", dockerImageName, containerId); profiler.start("Inspecting container"); containerInfo = dockerClient.inspectContainerCmd(containerId).exec(); containerName = containerInfo.getName(); profiler.start("Call containerIsStarting on subclasses"); containerIsStarting(containerInfo); profiler.start("Wait until container has started properly, or there's evidence it failed to start."); if (!this.startupCheckStrategy.waitUntilStartupSuccessful(dockerClient, containerId)) { throw new IllegalStateException("Container did not start correctly."); } profiler.start("Wait until container started properly"); 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); } finally { profiler.stop(); } }