Docker-java: windows volume mount exception

Created on 16 Mar 2020  路  9Comments  路  Source: docker-java/docker-java

I am not sure if this is a bug or something I am doing wrong, but here it goes:

I create a container using:

  • .withWorkingDir(WORKSPACE), where workspace is fort example /workspace
  • .withBinds(Bind.parse(volumePath + ":" + WORKSPACE)) , where volumePath is D:testpath

When trying to create the container, the following exception is run:

Caught: com.github.dockerjava.api.exception.InternalServerErrorException: invalid volume specification: '/host_mnt/d/testpath:rw'
com.github.dockerjava.api.exception.InternalServerErrorException: invalid volume specification: '/host_mnt/d/testpath:rw'
 at com.github.dockerjava.jaxrs.filter.ResponseStatusExceptionFilter.filter(ResponseStatusExceptionFilter.java:72)
 at org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:171)
 at org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:159)
 at org.glassfish.jersey.process.internal.Stages.process(Stages.java:147)
 at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:301)
 at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$0(JerseyInvocation.java:609)
 at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
 at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
 at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
 at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
 at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:608)
 at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:421)
 at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:327)
...

Is this expected? I could not find an example for windows machines.
Thanks

All 9 comments

win paths are not supported yet

Noooooo, that is super sad... is this a super difficult task or is this something that could be done by "normal"programmers? :-)
Is there a plan to do this? Or some documentation about what would be necessary?
I really love the library...

Thanks for any hint.

@moovida try using Bind(String path, Volume volume) constructor directly instead of Bind.parse

There were two not ended PRs afair on off is https://github.com/docker-java/docker-java/pull/919/files

@moovida try using Bind(String path, Volume volume) constructor directly instead of Bind.parse

Hi @bsideup , looking at the code I see that it splits and applies the constructor you are suggesting, so I assume it would not work:

            String[] parts = serialized.split(":");
            switch (parts.length) {
            case 2: {
                return new Bind(parts[0], new Volume(parts[1]));
            }

Did you have a working windows case with this?
Thanks!

@moovida you have : in the path (D:\testpath), so the splitting does not work correctly. This is why I suggest you to try the constructor instead.

@bsideup , thanks a lot for your suggestion, you made my day. It works like a charm.

Now I am puzzled about why it is said that windows paths are not supported?
Maybe my usecase is super simple, as I am just executing docker commands from a desktop application locally.

@moovida well, @KostyaSha should have said that it is not supported by Bind.parse, not by the library overall.

Thanks a ton @bsideup et all, closing this here.

Was this page helpful?
0 / 5 - 0 ratings