You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Could not find a valid Docker environment. Please see logs and check configuration #4008
I have seen similar issues here but I have not found a solution yet to my problem.
I would like to open a new thread here and see if if there is a clear solution for this.
I am using testcontainers 1.15.3:
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:215)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:207)
at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:136)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:178)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
at org.testcontainers.containers.GenericContainer.starting(GenericContainer.java:1029)
at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Java 11 installed with homebrew: DK Runtime Environment (build 11.0.10+9) OpenJDK 64-Bit Server VM (build 11.0.10+9, mixed mode)
@cvetan Testcontainers works great with ARM JDKs (I am using M1 myself, btw). Just make sure that you have a version of JNA on classpath that supports M1 (some projects hard force JNA to old versions, for example. 5.7.0 and newer work great with M1).
Testcontainers 1.15.3 depends on JNA 5.8.0 transitively via docker-java 3.2.8. So, as long as your project isn't doing something shady (e.g. forcing some old versions of transitive dependencies), you will be fine :)
For future reference:
While using 1.17.3 I keep getting the "cannot find executable" error mentioned at this issue's description.
So I downgraded to 1.15.3 and it started working 🤷♂️
I'm running it on a M1 chip, with Docker Desktop 4.10.1 (82475), Java 11, JUnit 4 and docker image confluentinc/cp-kafka:7.0.5-1-ubi8.arm64.
@tioback can you share a sample project that reproduce the issue, please? I have executed the tests in the project with the arm image for kafka and zookeper and everything went well. I think the issue can be related to the project dependencies
@bsideup@eddumelendez I've run into this again (last time was an old elasticsearch jar), this time the only JNA dep I see from mvn dependency:tree is from myProject => testcontainers:jar:1.17.3:compile => docker-java-transport-zerodep:jar:3.2.13:compile => jna:jar:4.5.2:compile. Confused why/how it's getting a low version...
Activity
bsideup commentedon Apr 21, 2021
Hi @diogomonte,
Please share full logs.
diogomonte commentedon Apr 21, 2021
Hi @bsideup ,
I actually just fixed the issue adding these 2 dependencies together with the latest testcontainers:
cvetan commentedon Apr 21, 2021
@diogomonte do you happen to use ARM JDK or Mac with apple silicon chip? The same happens to me with ARM JDK and I wanted to open the same issue.
Completely the same configuration works with JDK for amd64 platform. When I swith to ARM JDK because performance is much much better, tests crash.
diogomonte commentedon Apr 21, 2021
Hi @cvetan
Yes. I have the Mac with apple silicon chip.
Try to add these 2 dependencies:
bsideup commentedon Apr 21, 2021
@diogomonte FYI 1.15.3 already depends on them:
https://mvnrepository.com/artifact/org.testcontainers/testcontainers/1.15.3
so maybe there was something that was overriding the dependencies. Anyways, I am glad that you got it solved 👍
cvetan commentedon Apr 21, 2021
@bsideup Could something be done to support ARM JDK? Because I expect it will be more and more required since new macs will probably more widely used.
bsideup commentedon Apr 21, 2021
@cvetan Testcontainers works great with ARM JDKs (I am using M1 myself, btw). Just make sure that you have a version of JNA on classpath that supports M1 (some projects hard force JNA to old versions, for example. 5.7.0 and newer work great with M1).
Testcontainers 1.15.3 depends on JNA 5.8.0 transitively via docker-java 3.2.8. So, as long as your project isn't doing something shady (e.g. forcing some old versions of transitive dependencies), you will be fine :)
cvetan commentedon Apr 21, 2021
@bsideup Thanks I will check that out.
martinvw commentedon Apr 22, 2021
Thanks @bsideup for the new release and the heads up, however I still face some errors here.
It seems that while there is a dependency to docker-java-transport-zerodep 3.2.8 which depends on jna 5.8.0 there is also a dependency on org.rnorth.visible-assertions » visible-assertions » 2.1.2 which depends on jna 5.2.0
At least on my machine it still shows jna 5.2.0 if I don't force 5.8.0:
See the following fragment of
mvn dependency:treePS no further occurrences of jna appear in the output
tioback commentedon Aug 5, 2022
For future reference:
While using
1.17.3I keep getting the "cannot find executable" error mentioned at this issue's description.So I downgraded to
1.15.3and it started working 🤷♂️I'm running it on a M1 chip, with Docker Desktop 4.10.1 (82475), Java 11, JUnit 4 and docker image
confluentinc/cp-kafka:7.0.5-1-ubi8.arm64.eddumelendez commentedon Aug 5, 2022
@tioback can you share a sample project that reproduce the issue, please? I have executed the tests in the project with the arm image for kafka and zookeper and everything went well. I think the issue can be related to the project dependencies
JohnnyMarnell commentedon Sep 14, 2022
@bsideup @eddumelendez I've run into this again (last time was an old elasticsearch jar), this time the only JNA dep I see from
mvn dependency:treeis frommyProject => testcontainers:jar:1.17.3:compile => docker-java-transport-zerodep:jar:3.2.13:compile => jna:jar:4.5.2:compile. Confused why/how it's getting a low version...carolcoral commentedon Oct 22, 2024
How to fix it? It still happed.And i had add these dependencies:
Version
josesaid commentedon Dec 31, 2024
By using this solution fixed my issue, thanks
#4008 (comment)