diff --git a/core/src/main/java/org/testcontainers/DockerClientFactory.java b/core/src/main/java/org/testcontainers/DockerClientFactory.java index ac769dc384e..0e68cc87965 100644 --- a/core/src/main/java/org/testcontainers/DockerClientFactory.java +++ b/core/src/main/java/org/testcontainers/DockerClientFactory.java @@ -40,7 +40,8 @@ public class DockerClientFactory { asList(new EnvironmentAndSystemPropertyClientProviderStrategy(), new UnixSocketClientProviderStrategy(), new ProxiedUnixSocketClientProviderStrategy(), - new DockerMachineClientProviderStrategy()); + new DockerMachineClientProviderStrategy(), + new WindowsClientProviderStrategy()); private String activeApiVersion; private String activeExecutionDriver; diff --git a/core/src/main/java/org/testcontainers/dockerclient/WindowsClientProviderStrategy.java b/core/src/main/java/org/testcontainers/dockerclient/WindowsClientProviderStrategy.java new file mode 100644 index 00000000000..15cd35c48bf --- /dev/null +++ b/core/src/main/java/org/testcontainers/dockerclient/WindowsClientProviderStrategy.java @@ -0,0 +1,35 @@ +package org.testcontainers.dockerclient; + +import com.github.dockerjava.core.DefaultDockerClientConfig; +import com.github.dockerjava.core.DockerClientConfig; +import org.jetbrains.annotations.NotNull; + +public class WindowsClientProviderStrategy extends DockerClientProviderStrategy { + + private static final int PING_TIMEOUT_DEFAULT = 5; + private static final String PING_TIMEOUT_PROPERTY_NAME = "testcontainers.windowsprovider.timeout"; + + @Override + public void test() throws InvalidConfigurationException { + config = tryConfiguration("tcp://localhost:2375"); + } + + @Override + public String getDescription() { + return "Docker for Windows (via TCP port 2375)"; + } + + @NotNull + protected DockerClientConfig tryConfiguration(String dockerHost) { + config = DefaultDockerClientConfig.createDefaultConfigBuilder() + .withDockerHost(dockerHost) + .withDockerTlsVerify(false) + .build(); + client = getClientForConfig(config); + + final int timeout = Integer.getInteger(PING_TIMEOUT_PROPERTY_NAME, PING_TIMEOUT_DEFAULT); + ping(client, timeout); + + return config; + } +} diff --git a/docs/compatibility.md b/docs/compatibility.md index aca1d8c3d12..41cc87c4627 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -9,4 +9,4 @@ | Mac OS X - Docker Toolbox | Docker Machine v0.8.0 | | | Mac OS X - Docker for Mac | 1.12.0 | *Support is best-efforts at present*. `getTestHostIpAddress()` is [not currently supported](https://github.com/testcontainers/testcontainers-java/issues/166) due to limitations in Docker for Mac. | | Windows - Docker Toolbox | | *Support is limited at present and this is not currently tested on a regular basis*. | -| Windows - Docker for Windows Beta | | *Not currently supported*. | +| Windows - Docker for Windows | | *Supported is limited at present (Docker Compose tests are failing) and not currently tested on a regular basis.* |