Could not find docker, looked in: DockerCommandLocations
ioreskovic opened this issue · 6 comments
Hi there,
I've cloned this setup https://github.com/tomasulo/docker-compose-integration-tests with 0.32.1 version of docker-compose-rule, and I'm getting the following exception when I run
./gradlew integrationTest
java.lang.ExceptionInInitializerError
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:156)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1088)
at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
at java.lang.reflect.Field.get(Field.java:393)
at org.junit.runners.model.FrameworkField.get(FrameworkField.java:73)
at org.junit.runners.model.TestClass.getAnnotatedFieldValues(TestClass.java:230)
at org.junit.runners.ParentRunner.classRules(ParentRunner.java:255)
at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:244)
at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:194)
at org.junit.runners.ParentRunner.run(ParentRunner.java:362)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy3.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Could not find docker, looked in: DockerCommandLocations{possiblePaths=[null, /usr/local/bin/docker, /usr/bin/docker]}
at com.palantir.docker.compose.execution.DockerExecutable.lambda$dockerPath$15(DockerExecutable.java:45)
at java.util.Optional.orElseThrow(Optional.java:290)
at com.palantir.docker.compose.execution.DockerExecutable.dockerPath(DockerExecutable.java:45)
at com.palantir.docker.compose.execution.ImmutableDockerExecutable.<init>(ImmutableDockerExecutable.java:32)
at com.palantir.docker.compose.execution.ImmutableDockerExecutable.<init>(ImmutableDockerExecutable.java:19)
at com.palantir.docker.compose.execution.ImmutableDockerExecutable$Builder.build(ImmutableDockerExecutable.java:186)
at com.palantir.docker.compose.DockerComposeRule.dockerExecutable(DockerComposeRule.java:84)
at com.palantir.docker.compose.ImmutableDockerComposeRule.access$3201(ImmutableDockerComposeRule.java:32)
at com.palantir.docker.compose.ImmutableDockerComposeRule$InitShim.dockerExecutable(ImmutableDockerComposeRule.java:205)
at com.palantir.docker.compose.ImmutableDockerComposeRule.<init>(ImmutableDockerComposeRule.java:94)
at com.palantir.docker.compose.ImmutableDockerComposeRule.<init>(ImmutableDockerComposeRule.java:32)
at com.palantir.docker.compose.ImmutableDockerComposeRule$Builder.build(ImmutableDockerComposeRule.java:1352)
at com.tomasulo.sample.infrastructure.UserRepositoryIntegrationTest.<clinit>(UserRepositoryIntegrationTest.java:45)
... 38 more
I'm running Docker for Windows, and executing from Git Bash on Windows 10.
I have my environment variables set:
DOCKER_COMPOSE_LOCATION=C:\Program Files\Docker\Docker\resources\bin
DOCKER_LOCATION=C:\Program Files\Docker\Docker\resources\bin
Edit:
It has worked now, however, the following exception is now thrown:
java.io.IOException: Cannot run program "C:\Program Files\Docker\Docker\resources\bin": CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.palantir.docker.compose.execution.DockerComposeExecutable.execute(DockerComposeExecutable.java:101)
at com.palantir.docker.compose.execution.Command.run(Command.java:70)
at com.palantir.docker.compose.execution.Command.execute(Command.java:47)
at com.palantir.docker.compose.execution.DefaultDockerCompose.build(DefaultDockerCompose.java:74)
at com.palantir.docker.compose.execution.DelegatingDockerCompose.build(DelegatingDockerCompose.java:40)
at com.palantir.docker.compose.execution.RetryingDockerCompose.build(RetryingDockerCompose.java:22)
at com.palantir.docker.compose.DockerComposeRule.before(DockerComposeRule.java:143)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy3.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 36 more
I'm assuming it has something to do with Windows security, but I've given full access to docker executables, but the problem still persists.
Nevermind, the issue is that DOCKER_COMPOSE_LOCATION and DOCKER_LOCATION require path to executable, not their base folder.
DOCKER_COMPOSE_LOCATION=C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe
DOCKER_LOCATION=C:\Program Files\Docker\Docker\resources\bin\docker.exe
Is there any chance that you still remember what you changed between your first and second comment?
I've set my enviroment variables as per your last comment #219 (comment) but I'm still stuck on the first Issue.
I don't think I changed anything else.
If you're running it in terminal/IDE, try restarting it so they pick up env changes.
Also, I believe Docker now requires you have a password set for your Windows account, so try that as well.
duh, should've thought of restarting the terminal.. Now on to the next issue :)
Thanks a lot
I'm facing the same problem, but I'm using linux and my environment is correct, I could for example, finding using echo $DOCKER_COMPOSE_LOCATION. Could someone help me?