Skip to content

Commit

Permalink
feat: localhost used as containers host if WSL detected Fixes #294
Browse files Browse the repository at this point in the history
  • Loading branch information
augi committed Dec 15, 2021
1 parent 07ba415 commit 29ad99c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> networkSettings = inspection.NetworkSettings
Map<String, Object> networks = networkSettings.Networks
Map.Entry<String, Object> firstNetworkPair = networks.find()
Expand Down Expand Up @@ -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')
}
}

0 comments on commit 29ad99c

Please sign in to comment.