Repository navigation
Docker for Windows : 2.3.7.0 - Cannot construct instance of com.github.dockerjava.api.model.Binds #1462
Copy link
Copy link
Closed
Labels
Description
PS ( I rollback to Docker Desktop Community 2.3.6.2 and the problem is gone)
Docker for Windows : 2.3.7.0
Docker version 19.03.13-beta2, build ff3fbc9d55
private static final DockerComposeContainer container = new DockerComposeContainer(new File("src/test/resources/docker-compose-twin.yaml"));
public Map<String, String> start() {
container.waitingFor("twin-api-service", Wait.forLogMessage(".*Database was successfully initialized.*\\s", 1));
container.withTailChildContainers(true);
container.start();
}
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:526)
at io.quarkus.test.junit.QuarkusTestExtension.interceptBeforeAllMethod(QuarkusTestExtension.java:578)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:126)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeAllMethod(TimeoutExtension.java:68)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllMethods$8(ClassBasedTestDescriptor.java:375)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllMethods(ClassBasedTestDescriptor.java:373)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:193)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:228)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:504)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:537)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:359)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
... 31 more
Suppressed: java.lang.RuntimeException: Unable to stop Quarkus test resource com.comact.iep.codec.TwinApiServiceDockerCompose@d25e878
at io.quarkus.test.common.TestResourceManager.close(TestResourceManager.java:98)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:277)
... 37 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:330)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:311)
at org.testcontainers.containers.ContainerisedDockerCompose.invoke(DockerComposeContainer.java:609)
at org.testcontainers.containers.DockerComposeContainer.runWithCompose(DockerComposeContainer.java:278)
at org.testcontainers.containers.DockerComposeContainer.stop(DockerComposeContainer.java:314)
at org.testcontainers.lifecycle.Startable.close(Startable.java:18)
at com.comact.iep.codec.TwinApiServiceDockerCompose.stop(TwinApiServiceDockerCompose.java:42)
at io.quarkus.test.common.TestResourceManager.close(TestResourceManager.java:96)
... 38 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:323)
... 45 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:498)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:325)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
... 46 more
Caused by: java.lang.RuntimeException: org.testcontainers.shaded.com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of `com.github.dockerjava.api.model.Binds`, problem: Error parsing Bind 'C:/workspace/src/test/resources/:/c/workspace/src/test/resources/:ro'
at [Source: (org.testcontainers.shaded.okio.RealBufferedSource$1); line: 1, column: 1320] (through reference chain: com.github.dockerjava.api.command.InspectContainerResponse["HostConfig"]->com.github.dockerjava.api.model.HostConfig["Binds"])
at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.get(OkHttpInvocationBuilder.java:92)
at com.github.dockerjava.core.exec.InspectContainerCmdExec.execute(InspectContainerCmdExec.java:31)
at com.github.dockerjava.core.exec.InspectContainerCmdExec.execute(InspectContainerCmdExec.java:13)
at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
at com.github.dockerjava.core.command.InspectContainerCmdImpl.exec(InspectContainerCmdImpl.java:52)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:428)
... 48 more
Caused by: org.testcontainers.shaded.com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of `com.github.dockerjava.api.model.Binds`, problem: Error parsing Bind 'C:/workspace/src/test/resources/:/c/workspace/src/test/resources/:ro'
at [Source: (org.testcontainers.shaded.okio.RealBufferedSource$1); line: 1, column: 1320] (through reference chain: com.github.dockerjava.api.command.InspectContainerResponse["HostConfig"]->com.github.dockerjava.api.model.HostConfig["Binds"])
at org.testcontainers.shaded.com.fasterxml.jackson.databind.exc.ValueInstantiationException.from(ValueInstantiationException.java:47)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1735)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.wrapAsJsonMappingException(StdValueInstantiator.java:491)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.rewrapCtorProblem(StdValueInstantiator.java:514)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator._createUsingDelegate(StdValueInstantiator.java:551)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingDelegate(StdValueInstantiator.java:298)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingArrayDelegate(StdValueInstantiator.java:307)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1435)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:185)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4218)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3259)
at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.get(OkHttpInvocationBuilder.java:90)
... 54 more
Caused by: java.lang.IllegalArgumentException: Error parsing Bind 'C:/workspace/src/test/resources/:/c/workspace/src/test/resources/:ro'
at com.github.dockerjava.api.model.Bind.parse(Bind.java:134)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550)
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:517)
at com.github.dockerjava.api.model.Binds.fromPrimitive(Binds.java:30)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.introspect.AnnotatedMethod.call1(AnnotatedMethod.java:114)
at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator._createUsingDelegate(StdValueInstantiator.java:535)
... 68 more
Caused by: java.lang.IllegalArgumentException
at com.github.dockerjava.api.model.Bind.parse(Bind.java:130)
... 82 more
Reacted by 22f, Björn Michael, Shane Paul, mumutu66, bachkovsky-git, Steve and Ramya Loganathan
Activity
roastario commentedon Sep 23, 2020
I am hitting this same issue - it seems that docker-for-windows has recently changed how it presents information about mounts
in the previous version, it was providing:
/run/desktop/mnt/host/c/Users/roast/Documents/GitHub/corda-stress-testing/freighter-core/build/dockerScripts4631110804024367771:/opt/scripts:rwnotice that
C:\is replaced with a unix friendly path. In the new versions it is returning:C:\Users\roast\Documents\GitHub\corda-stress-testing\freighter-core\build\dockerScripts2722709394988798852:/opt/scripts:rwwhich is causing an exception in: https://github.com/docker-java/docker-java/blob/master/docker-java-api/src/main/java/com/github/dockerjava/api/model/Bind.java due to the fact that it's splitting into 4 pieces, which doesn't have a switch statement for it.
Will hopefully raise a PR to "join" the first two sections if this condition is met.
stale commentedon Oct 23, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
survivant commentedon Oct 29, 2020
issue still happening.. don't close it
TheHaf commentedon Nov 3, 2020
I can confirm this issue. I was previously running the stable Docker Desktop version 2.4.0.0 without issues. Now in 2.5.0.0 I get the issue, a colleague of mine has the same issue after updating to Docker Desktop version 2.5.0.0.
KasperTerndrup commentedon Nov 3, 2020
I am also having issues since the 2.5.0.0 along with a colleague of mine. It occurs when running tests which depend on testcontainers.
pauloricardomg commentedon Nov 3, 2020
I can confirm I encountered this issue on 2.5.0.0 and it was fixed after downgrading Docker Desktop to 2.4.0.0.
thirumalain commentedon Nov 3, 2020
Yes, We are also facing the same issue with 2.5.0.0!
mrshanepaul commentedon Nov 3, 2020
Same here, the only fix I can see is to downgrade to 2.4. We are also using testcontainers.
jglink commentedon Nov 4, 2020
Same here. With Docker 2.5 we get the shown exception but works fine with 2.4
mateuszlajming commentedon Nov 4, 2020
I also confirm that I encountered this issue on 2.5.0.0 and I had to downgrade the Docker Desktop to 2.4.0.0.
emenaceb commentedon Nov 6, 2020
The problem is due to parse() method of Bind class
In Windows there is an additional : in the bind C:\folder:/c/folder:rw
jglink commentedon Nov 6, 2020
@emenaceb there is already a pull-request for this: #1463
8 remaining items
bsideup commentedon Nov 23, 2020
@madisparn ok, now I see, thanks! I missed the important detail (forward slash), my bad!
Thanks for the PR, I will play with it a little and write more tests to ensure that we're not hitting edge cases on Linux
bsideup commentedon Nov 23, 2020
Funny enough,
C:/isn't something that the spec mentions:https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Oh God... I love Docker 😂
Fufusulier commentedon Nov 23, 2020
Ok I'll see to provide you that
Fufusulier commentedon Nov 23, 2020
There you go 👍
I don't know how to fix the format issue with the code :'(
bsideup commentedon Nov 23, 2020
@Fufusulier I fixed the formatting issue :)
Oh, so you control the binds? Why don't you use Windows' standard (backslash) notation then? Like this:
"C:\\dev/tmp/:/c/dev/tmp/:rw"Fufusulier commentedon Nov 23, 2020
Thanks for the formatting
Well I control them in the test to reproduce the error I have with testcontainer. I put the same binds as the ones testcontainer provides (and the one this is reported in the former exception). Perhaps the issue is related to testcontainer and not docker-java...
It works with the change you proposed "C:\..." (🥇 👍 ) but I don't know how testcontainer computes that value
bsideup commentedon Nov 23, 2020
@Fufusulier oh, so you're saying that Testcontainers passes the value as
C:/? O_O This is interesting, I will take a look. Thanks!bsideup commentedon Nov 23, 2020
@Fufusulier hint: consider using
MountableFile.forClasspathResourceorwithClasspathResourceMappingwithREAD_ONLYmode, so that it uses the copy API instead of file mountingFufusulier commentedon Nov 23, 2020
Ok. So testcontainer binds the folder that contains the yml file, and uses "C:/" instead of "C:\\" to docker-java. But I'm not sure why the code isn't working anymore since the update of Docker For Windows. That's probably something to discuss on their github...
@bsideup May be docker-java/src/test/java/com/github/dockerjava/api/model/BindTest.java (9019b87) should also handle the parsing of "C:/".
bsideup commentedon Nov 23, 2020
@Fufusulier it feels like they changed the behaviour and now binds are returned "as is", instead of "normalizing" them as it was done previously. I would say returning a normalized value is desired, consider reporting to them as well.
Fufusulier commentedon Nov 24, 2020
A PR with the fix has been opened testcontainers/testcontainers-java#3514 👍
bsideup commentedon Nov 24, 2020
Yes, we've identified an issue with
MountableFilein Testcontainers that causing the wrong slashes (/instead of\)I will try to reach out to Docker for Windows' team on why they stopped normalizing the paths. If this is intentional, we will need to support it in docker-java as well.
Fufusulier commentedon Nov 24, 2020
ok, thanks for your follow up and your quick reaction 🥇
bsideup commentedon Sep 13, 2021
As it was caused by a malformed request, I am going to close this issue. Please report if it happens again (with a valid bind)