Source:
public DockerClient client() { if (strategy != null) { return strategy.getClient(); } List<DockerClientProviderStrategy> configurationStrategies = new ArrayList<DockerClientProviderStrategy>(); ServiceLoader.load(DockerClientProviderStrategy.class).forEach( cs -> configurationStrategies.add( cs ) ); strategy = DockerClientProviderStrategy.getFirstValidStrategy(configurationStrategies); String hostIpAddress = strategy.getDockerHostIpAddress(); log.info("Docker host IP address is {}", hostIpAddress); DockerClient client = strategy.getClient(); if (!initialized) { Info dockerInfo = client.infoCmd().exec(); Version version = client.versionCmd().exec(); activeApiVersion = version.getApiVersion(); activeExecutionDriver = dockerInfo.getExecutionDriver(); log.info("Connected to docker: \n" + " Server Version: " + dockerInfo.getServerVersion() + "\n" + " API Version: " + activeApiVersion + "\n" + " Operating System: " + dockerInfo.getOperatingSystem() + "\n" + " Total Memory: " + dockerInfo.getMemTotal() / (1024 * 1024) + " MB"); String ryukContainerId = null; boolean useRyuk = !"false".equals(System.getenv("TESTCONTAINERS_RYUK_ENABLED")); if (useRyuk) { ryukContainerId = ResourceReaper.start(hostIpAddress, client); log.info("Ryuk started - will monitor and terminate Testcontainers containers on JVM exit"); } VisibleAssertions.info("Checking the system..."); checkDockerVersion(version.getVersion()); boolean checksEnabled = !TestcontainersConfiguration.getInstance().isDisableChecks(); if (checksEnabled) { if (ryukContainerId != null) { checkDiskSpace(client, ryukContainerId); } else { runInsideDocker( client, createContainerCmd -> { createContainerCmd.withName("testcontainers-checks-" + SESSION_ID); createContainerCmd.getHostConfig().withAutoRemove(true); createContainerCmd.withCmd("tail", "-f", "/dev/null"); }, (__, containerId) -> { checkDiskSpace(client, containerId); return ""; } ); } } initialized = true; } return client; }

Target:
public DockerClient client() { if (strategy != null) { return strategy.getClient(); } List<DockerClientProviderStrategy> configurationStrategies = new ArrayList<DockerClientProviderStrategy>(); ServiceLoader.load(DockerClientProviderStrategy.class).forEach( cs -> configurationStrategies.add( cs ) ); strategy = DockerClientProviderStrategy.getFirstValidStrategy(configurationStrategies); String hostIpAddress = strategy.getDockerHostIpAddress(); log.info("Docker host IP address is {}", hostIpAddress); DockerClient client = strategy.getClient(); if (!initialized) { Info dockerInfo = client.infoCmd().exec(); Version version = client.versionCmd().exec(); activeApiVersion = version.getApiVersion(); activeExecutionDriver = dockerInfo.getExecutionDriver(); log.info("Connected to docker: \n" + " Server Version: " + dockerInfo.getServerVersion() + "\n" + " API Version: " + activeApiVersion + "\n" + " Operating System: " + dockerInfo.getOperatingSystem() + "\n" + " Total Memory: " + dockerInfo.getMemTotal() / (1024 * 1024) + " MB"); String ryukContainerId = null; boolean useRyuk = !Boolean.parseBoolean(System.getenv("TESTCONTAINERS_RYUK_DISABLED")); if (useRyuk) { ryukContainerId = ResourceReaper.start(hostIpAddress, client); log.info("Ryuk started - will monitor and terminate Testcontainers containers on JVM exit"); } VisibleAssertions.info("Checking the system..."); checkDockerVersion(version.getVersion()); boolean checksEnabled = !TestcontainersConfiguration.getInstance().isDisableChecks(); if (checksEnabled) { if (ryukContainerId != null) { checkDiskSpace(client, ryukContainerId); } else { runInsideDocker( client, createContainerCmd -> { createContainerCmd.withName("testcontainers-checks-" + SESSION_ID); createContainerCmd.getHostConfig().withAutoRemove(true); createContainerCmd.withCmd("tail", "-f", "/dev/null"); }, (__, containerId) -> { checkDiskSpace(client, containerId); return ""; } ); } } initialized = true; } return client; }