Testcontainers-java: Parsing error after upgrading docker version on Windows

Created on 17 Nov 2020  路  5Comments  路  Source: testcontainers/testcontainers-java

Hi,

I am working on java testcontainers (version 1.14.3) on Windows. recently, my docker desktop version was upgraded from 2.4.0.0 to 2.5.0.0. since then I am getting those exceptions on initialization:

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:/dev/IM2/BackendTests/Tests/../run/community-eval/logs/:/service/community-eval/logs:rw'**
 at [Source: (org.testcontainers.shaded.okio.RealBufferedSource$1); line: 1, column: 1272] (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) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1735) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.wrapAsJsonMappingException(StdValueInstantiator.java:491) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.rewrapCtorProblem(StdValueInstantiator.java:514) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator._createUsingDelegate(StdValueInstantiator.java:551) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingDelegate(StdValueInstantiator.java:298) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingArrayDelegate(StdValueInstantiator.java:307) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1435) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:185) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4218) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3259) ~[testcontainers-1.14.3.jar:?]
    at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.get(OkHttpInvocationBuilder.java:90) ~[testcontainers-1.14.3.jar:?]
    at com.github.dockerjava.core.exec.InspectContainerCmdExec.execute(InspectContainerCmdExec.java:31) ~[testcontainers-1.14.3.jar:?]
    at com.github.dockerjava.core.exec.InspectContainerCmdExec.execute(InspectContainerCmdExec.java:13) ~[testcontainers-1.14.3.jar:?]
    at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21) ~[testcontainers-1.14.3.jar:?]
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35) ~[testcontainers-1.14.3.jar:?]
    at com.github.dockerjava.core.command.InspectContainerCmdImpl.exec(InspectContainerCmdImpl.java:52) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:428) ~[testcontainers-1.14.3.jar:?]
    at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:325) ~[testcontainers-1.14.3.jar:?]
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) ~[duct-tape-1.0.8.jar:?]
    at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:323) ~[testcontainers-1.14.3.jar:?]
    ... 24 more
**Caused by: java.lang.IllegalArgumentException: Error parsing Bind 'C:/dev/IM2/BackendTests/Tests/../run/community-eval/logs/:/service/community-eval/logs:rw'
    at com.github.dockerjava.api.model.Bind.parse(Bind.java:134) ~[testcontainers-1.14.3.jar:?]**
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_271]
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_271]
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_271]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_271]
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_271]
    at java.util.stream.AbstractPipeline.evaluateToArrayNode(Unknown Source) ~[?:1.8.0_271]
    at java.util.stream.ReferencePipeline.toArray(Unknown Source) ~[?:1.8.0_271]
    at com.github.dockerjava.api.model.Binds.fromPrimitive(Binds.java:30) ~[testcontainers-1.14.3.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_271]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_271]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_271]

It seems that Bind.parse method does not support Windows path at all.
However, in the previous docker desktop version(2.4.0.0) the Windows path was translated to /host_mnt/C/... which can be parsed by that function.

any idea how can this be resolved in new docker desktop version?

resolutioawaiting-release

Most helpful comment

Thank you. It works with 1.15.1. Problem solved. 馃憤

All 5 comments

I have the same problem.
For me the problem apears when I try to run tests through Intellij (under Windows, no WSL), but works fine from the WSL command.
This is a real setback for my development flow, as I have to context-switch from Intellij to running Maven manually in the WSL console.

At the moment I'm using testcontainers 1.14.2 and Docker Desktop 2.5.0.1

Getting the same error.

Docker Desktop Version: 2.5.0.1
docker version: 19.03.13, build 4484c46d9d
testcontainers version: 1.15.0

I have the same issue. You can follow up the discussion there as I initially though the problem was docker-java. https://github.com/docker-java/docker-java/issues/1462#issuecomment-732219270, in particular this comment https://github.com/docker-java/docker-java/issues/1462#issuecomment-732230340

Docker For Desktop 5.2.0.1 (49550), running the tests from IntelliJ. WSL1, using docker-java 3.2.6, testcontainer 1.15.0

Should be fixed in 1.15.1 - give it a try!

Thank you. It works with 1.15.1. Problem solved. 馃憤

Was this page helpful?
0 / 5 - 0 ratings