Skip to content

Commit 75c3cbf

Browse files
authored
Merge pull request #39 from avast/SupportDockerForWindows
Support for Docker For Windows
2 parents 1cdae8b + ece8f34 commit 75c3cbf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ class ComposeUp extends DefaultTask {
105105
if (dockerHost) {
106106
logger.debug("'DOCKER_HOST environment variable detected - will be used as hostname of service $serviceName'")
107107
new ServiceHost(host: dockerHost.toURI().host, type: ServiceHostType.RemoteDockerHost)
108-
} else if (isMac()) {
109-
// If running on Mac OS and DOCKER_HOST is not set, we can assume that
110-
// we are using Docker for Mac, in which case we should connect to localhost
108+
} else if (isMac() || isWindows()) {
109+
// If running on Mac OS or Windows, and DOCKER_HOST is not set, we can assume that
110+
// we are using Docker for Mac/Windows, in which case we should connect to localhost
111111
logger.debug("Will use localhost as host of $serviceName")
112112
new ServiceHost(host: 'localhost', type: ServiceHostType.LocalHost)
113113
} else {
@@ -225,4 +225,8 @@ class ComposeUp extends DefaultTask {
225225
private static boolean isMac() {
226226
System.getProperty("os.name").toLowerCase().startsWith("mac")
227227
}
228+
229+
private static boolean isWindows() {
230+
System.getProperty("os.name").toLowerCase().startsWith("win")
231+
}
228232
}

0 commit comments

Comments
 (0)