diff --git a/src/main/groovy/com/avast/gradle/dockercompose/DockerExecutor.groovy b/src/main/groovy/com/avast/gradle/dockercompose/DockerExecutor.groovy index 763b47d..047b147 100644 --- a/src/main/groovy/com/avast/gradle/dockercompose/DockerExecutor.groovy +++ b/src/main/groovy/com/avast/gradle/dockercompose/DockerExecutor.groovy @@ -113,6 +113,9 @@ class DockerExecutor { logger.lifecycle("DOCKER_HOST environment variable detected - will be used as hostname of service $serviceName ($host)'") return new ServiceHost(host: host, type: ServiceHostType.RemoteDockerHost) } + if (isWSL()) { + return new ServiceHost(host: 'localhost', type: ServiceHostType.LocalHost) + } Map networkSettings = inspection.NetworkSettings Map networks = networkSettings.Networks Map.Entry firstNetworkPair = networks.find() @@ -208,4 +211,8 @@ class DockerExecutor { private static boolean isWindows() { System.getProperty("os.name").toLowerCase().startsWith("win") } + + private static boolean isWSL() { + System.getProperty("os.version").toLowerCase().contains('wsl') + } }