Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows 10] Can't find local docker-compose #460

Closed
bsnisar opened this issue Sep 21, 2017 · 2 comments
Closed

[Windows 10] Can't find local docker-compose #460

bsnisar opened this issue Sep 21, 2017 · 2 comments

Comments

@bsnisar
Copy link
Contributor

bsnisar commented Sep 21, 2017

GIVEN: Win 10 machine
<dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers</artifactId> <version>1.4.2</version> <scope>test</scope> </dependency>

WHEN: Start docker compose in a test

@ClassRule
public static DockerComposeContainer dockerCompose = new DockerComposeContainer(ID, COMPOSE_FILE)
        .withLocalCompose(true)
        .withPull(false)
        .withTailChildContainers(true)
        .withExposedService("elastic", 9200)
        .withExposedService("logstash", 9600)
        .withExposedService("stats", 8282);

`

THEN:
org.testcontainers.containers.ContainerLaunchException: Local Docker Compose not found. Is docker-compose on the PATH? at org.testcontainers.containers.LocalDockerCompose.invoke(DockerComposeContainer.java:497) at org.testcontainers.containers.DockerComposeContainer.runWithCompose(DockerComposeContainer.java:151) at org.testcontainers.containers.DockerComposeContainer.createServices(DockerComposeContainer.java:127) at org.testcontainers.containers.DockerComposeContainer.starting(DockerComposeContainer.java:111)

This heppend because of (DockerComposeContainer, line 498): CommandLine.executableExists(COMPOSE_EXECUTABLE)

public static boolean executableExists(String executable) {

    // First check if we've been given the full path already
    File directFile = new File(executable);
    if (directFile.exists() && directFile.canExecute()) {
        return true;
    }

    for (String pathString : getSystemPath()) {
        Path path = Paths.get(pathString);
        if (Files.exists(path.resolve(executable)) && Files.isExecutable(path.resolve(executable))) {
            return true;
        }
    }

    return false;
}

File like docker-compose can't be resolved in PATH, because of there is docker-compose.exe binary on Win10, not simple docker-compose.

@bsnisar
Copy link
Contributor Author

bsnisar commented Sep 21, 2017

I have create a pull request for this issue please review, guys.

bsnisar pushed a commit to bsnisar/testcontainers-java that referenced this issue Sep 21, 2017
@bsnisar
Copy link
Contributor Author

bsnisar commented Sep 22, 2017 via email

bsnisar pushed a commit to bsnisar/testcontainers-java that referenced this issue Sep 22, 2017
bsnisar pushed a commit to bsnisar/testcontainers-java that referenced this issue Sep 27, 2017
bsnisar pushed a commit to bsnisar/testcontainers-java that referenced this issue Sep 28, 2017
@kiview kiview closed this as completed in 540f567 Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant