简体   繁体   中英

org.testcontainers.dockerclient.DockerMachineClientProviderStrategy - docker-machine executable was not found

When I try to run test containers I get the following error.

The docker machine not found in /root/.sdkman/candidates/gradle/current/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sac/tools/bin, /sac/tools/apache-ant-1.7.1/bin, /dsc/ddemainbuild/thirdparty/gradle/bin, /root/java11/openjdk-11.0.5/linux-x64/bin, /root/bin

This failure happens randomly. During successful execution, I get

DockerClientProviderStrategy - Found Docker environment with local Unix socket (unix:///var/run/docker.sock)

What is the cause for random failure? Attached the failing logs.

12:20:54.272 [Test worker] INFO  org.testcontainers.dockerclient.DockerMachineClientProviderStrategy - docker-machine executable was not found on PATH ([/root/.sdkman/candidates/gradle/current/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sac/tools/bin, /sac/tools/apache-ant-1.7.1/bin, /dsc/ddemainbuild/thirdparty/gradle/bin, /root/java11/openjdk-11.0.5/linux-x64/bin, /root/bin])
12:20:54.274 [Test worker] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
12:20:54.275 [Test worker] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy -     UnixSocketClientProviderStrategy: failed with exception TimeoutException (org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException). Root cause TimeoutException (null)
12:20:54.275 [Test worker] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continue
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
    at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$4(DockerClientProviderStrategy.java:156)
    at java.base/java.util.Optional.orElseThrow(Optional.java:408)

DockerMachineClientProviderStrategy is one of the last strategies Testcontainers tries out when looking for a working Docker environment. This means if you get this error, all previous strategy tests failed, so your actual error is likely unrelated to Docker Machine in any way.

From your description, I would expect, that you have a regular Docker installation, and UnixSocketClientProviderStrategy should be successful. Reasons, why it would sometimes fail, can be (among others) the Docker daemon failing to answer to ping requests, because of being under heavy load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM