Skip to content

Commit 540f567

Browse files
bsnisarkiview
authored andcommitted
Fix docker-compose executable check for Win10 (#461)
* Use .exe suffix on Windows when looking for docker-compose executable Fixes #460
1 parent 0da7fca commit 540f567

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file.
33

44
## UNRELEASED
55
### Fixed
6-
- Fixed local Docker Compose executable name resolution on Windows (#416)
6+
- Fixed local Docker Compose executable name resolution on Windows (#416, #460)
77
- Fixed TAR composition on Windows (#444)
88
- Allowing `addExposedPort` to be used after ports have been specified with `withExposedPorts` (#453)
99
- Stopping creation of temporary directory prior to creating temporary file (#443)

core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ public DockerCompose withEnv(Map<String, String> env) {
494494
@Override
495495
public void invoke() {
496496
// bail out early
497-
if (!CommandLine.executableExists(COMPOSE_EXECUTABLE)) {
497+
if (!dockerComposeExecutableExists()) {
498498
throw new ContainerLaunchException("Local Docker Compose not found. Is " + COMPOSE_EXECUTABLE + " on the PATH?");
499499
}
500500

@@ -531,6 +531,14 @@ public void invoke() {
531531
}
532532
}
533533

534+
private boolean dockerComposeExecutableExists() {
535+
if (SystemUtils.IS_OS_WINDOWS) {
536+
return CommandLine.executableExists(COMPOSE_EXECUTABLE + ".exe");
537+
} else {
538+
return CommandLine.executableExists(COMPOSE_EXECUTABLE);
539+
}
540+
}
541+
534542
/**
535543
* @return a logger
536544
*/

0 commit comments

Comments
 (0)