Fix docker-compose executable check for Win10 (#460)#461
Fix docker-compose executable check for Win10 (#460)#461kiview merged 7 commits intotestcontainers:masterfrom
Conversation
|
Do we run tests for local compose on Windows? I have to check at home on my Windows box. I also wonder how https://github.com/bsnisar/testcontainers-java/blob/61d9b0e1972a8be0530d22368ee9ff200172ca6d/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java#L512 works, if we have to append |
kiview
left a comment
There was a problem hiding this comment.
I think I would prefer to make the value of COMPOSE_EXECUTABLE OS dependent, if that's what we also need when calling the docker-compose executable.
| } | ||
| } | ||
|
|
||
| // #460 : docker-compose are not resolvable on Win10 machines because there is docker-compose.exe binary, |
There was a problem hiding this comment.
I think we can omit this comment (or change it to correct Javadoc comment syntax, but I prefer omitting it).
|
|
||
| // #460 : docker-compose are not resolvable on Win10 machines because there is docker-compose.exe binary, | ||
| // but not docker-compose | ||
| private boolean isDockerComposeExists() { |
There was a problem hiding this comment.
I would prefer renaming the method to something like dockerComposeExecutableExists.
|
Hi @kiview , in my case for Win10 docker-compose is accessible locally on my cmd: But during the check inside CommandLine(executable = "docker-compose"): this loop will find (among other locations) somthing like C:\Program Files\Docker\Docker\Resources\bin where no docker-compose file: C:\Program Files\Docker\Docker\resources\bin>dir Directory of C:\Program Files\Docker\Docker\resources\bin 09/10/2017 12:51 PM .09/10/2017 12:51 PM .. 09/10/2017 12:51 PM 6,380,236 docker-compose.exe 09/10/2017 12:51 PM 2,436,096 docker-credential-wincred.exe 09/10/2017 12:51 PM 26,885,120 docker-machine.exe 09/10/2017 12:51 PM 19,135,488 docker.exe 09/10/2017 12:51 PM 8,162,816 notary.exe As a result even if the command is executable, run will be failed by So, for me simple fix for executable check looks good enough to satisfy this case. |
|
|
||
| // #460 : docker-compose are not resolvable on Win10 machines because there is docker-compose.exe binary, | ||
| // but not docker-compose | ||
| private boolean isDockerComposeExists() { |
There was a problem hiding this comment.
What if we change this method to:
if (SystemUtils.IS_OS_WINDOWS) {
return CommandLine.executableExists(COMPOSE_EXECUTABLE + ".exe");
} else {
return CommandLine.executableExists(COMPOSE_EXECUTABLE);
}
There was a problem hiding this comment.
This variant more readable and looks better, but narrows all possible options to *.exe variant on Win machines.
How docker-compose executable looks on other Win platforms (not Win10) ?
There was a problem hiding this comment.
Since we currently only support Docker for Windows on Windows 10 (see Windows support), I would be fine with this.
There was a problem hiding this comment.
In this case I will rewrite it.
Also, what about this variant:
return SystemUtils.IS_OS_WINDOWS
? CommandLine.executableExists(COMPOSE_EXECUTABLE + ".exe")
: CommandLine.executableExists(COMPOSE_EXECUTABLE);
|
|
||
| // #460 : docker-compose are not resolvable on Win10 machines because there is docker-compose.exe binary, | ||
| // but not docker-compose | ||
| private boolean isDockerComposeExists() { |
There was a problem hiding this comment.
Since we currently only support Docker for Windows on Windows 10 (see Windows support), I would be fine with this.
|
@kiview I have updated it. |
|
|
||
| ## UNRELEASED | ||
| ### Fixed | ||
| - Fixed local Docker Compose executable name resolution on Windows (#416) |
There was a problem hiding this comment.
What I meant, was referencing both issues here ;)
|
@kiview Ouh, its my misstate. I have just fixed it. |
|
@bsnisar @kiview Seems the issue is still remains. And second time here: UPD: |

This is fix for issue: #460