Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker compose path mapping on Windows #221

Closed
scetix opened this issue Sep 10, 2016 · 6 comments
Closed

Docker compose path mapping on Windows #221

scetix opened this issue Sep 10, 2016 · 6 comments

Comments

@scetix
Copy link
Contributor

scetix commented Sep 10, 2016

There is an issue binding compose file on Windows systems, since there is a direct mapping from Windows to Linux filesystem with drive letter. The issue seems to be in DockerComposeContainer.java:

String pwd = composeFile.getAbsoluteFile().getParentFile().getAbsolutePath();
addEnv("COMPOSE_FILE", pwd + "/" + composeFile.getAbsoluteFile().getName());
addFileSystemBind(pwd, pwd, READ_ONLY);
@rnorth
Copy link
Member

rnorth commented Sep 11, 2016

@scetix thanks. Could you possibly clarify exact how the problem is materializing? i.e. what values are you seeing for the variables in the above, and what do you think they need to be?
Thanks
Richard

@scetix
Copy link
Contributor Author

scetix commented Sep 12, 2016

No problem, this is what it get running DockerComposeV2WithNetworkTest:

08:58:08.116 INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Looking for Docker environment. Trying Environment variables, system properties and defaults. Resolved: 

08:58:08.661 DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
08:58:09.066 INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Found docker client settings from environment
08:58:09.070 INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Docker host IP address is localhost
08:58:09.372 INFO  org.testcontainers.DockerClientFactory - Connected to docker: 
  Server Version: 1.12.0
  API Version: 1.24
  Operating System: Alpine Linux v3.4
  Total Memory: 1997 MB
08:58:10.201 INFO  org.testcontainers.DockerClientFactory - Disk utilization in Docker environment is 3% (51663 MB available)
08:58:10.494 DEBUG docker[docker/compose:1.8.0] - Starting container: docker/compose:1.8.0
08:58:10.495 DEBUG docker[docker/compose:1.8.0] - Trying to start container: docker/compose:1.8.0
08:58:10.495 DEBUG docker[docker/compose:1.8.0] - Trying to start container: docker/compose:1.8.0 (attempt 1/1)
08:58:10.496 DEBUG docker[docker/compose:1.8.0] - Starting container: docker/compose:1.8.0
08:58:10.496 INFO  docker[docker/compose:1.8.0] - Creating container for image: docker/compose:1.8.0
08:58:10.553 ERROR com.github.dockerjava.core.async.ResultCallbackTemplate - Error during callback
com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"Invalid bind mount spec \"/c/test/testcontainers-java/core/src/test/resources:C:\\\\test\\\\testcontainers-java\\\\core\\\\src\\\\test\\\\resources:ro\": Invalid volume specification: '/c/test/testcontainers-java/core/src/test/resources:C:\\test\\testcontainers-java\\core\\src\\test\\resources:ro'"}

    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:109) [docker-java-3.0.5.jar:na]
    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:33) [docker-java-3.0.5.jar:na]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:233) [netty-handler-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [netty-codec-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) [netty-codec-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:571) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:512) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:426) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:398) [netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877) [netty-common-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [netty-common-4.1.3.Final.jar:4.1.3.Final]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_74]
08:58:10.565 ERROR docker[docker/compose:1.8.0] - Could not start container
com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"Invalid bind mount spec \"/c/test/testcontainers-java/core/src/test/resources:C:\\\\test\\\\testcontainers-java\\\\core\\\\src\\\\test\\\\resources:ro\": Invalid volume specification: '/c/test/testcontainers-java/core/src/test/resources:C:\\test\\testcontainers-java\\core\\src\\test\\resources:ro'"}

    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:109) ~[docker-java-3.0.5.jar:na]
    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:33) ~[docker-java-3.0.5.jar:na]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:233) ~[netty-handler-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) ~[netty-codec-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) ~[netty-codec-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:571) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:512) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:426) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:398) ~[netty-transport-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877) ~[netty-common-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) ~[netty-common-4.1.3.Final.jar:4.1.3.Final]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_74]
08:58:10.574 ERROR docker[docker/compose:1.8.0] - Container log output (if any) will follow:

org.testcontainers.containers.ContainerLaunchException: Container startup failed
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:174)
    at org.testcontainers.containers.DockerCompose.start(DockerComposeContainer.java:305)
    at org.testcontainers.containers.DockerComposeContainer.pullImages(DockerComposeContainer.java:92)
    at org.testcontainers.containers.DockerComposeContainer.starting(DockerComposeContainer.java:82)
    at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:28)
    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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    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:78)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:83)
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:167)
    ... 24 more
Caused by: java.lang.NullPointerException: containerId was not specified
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:228)
    at com.github.dockerjava.core.command.LogContainerCmdImpl.withContainerId(LogContainerCmdImpl.java:78)
    at com.github.dockerjava.core.command.LogContainerCmdImpl.<init>(LogContainerCmdImpl.java:38)
    at com.github.dockerjava.core.DockerClientImpl.logContainerCmd(DockerClientImpl.java:335)
    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:231)
    at org.testcontainers.containers.GenericContainer.lambda$start$0(GenericContainer.java:169)
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
    ... 25 more

As you can see the absolute path to the compose file is MinGW compatible, but it still doesnt work. If i change container path to for example: /compose it works. But from what I see this was removed to support relative paths.

@scetix
Copy link
Contributor Author

scetix commented Sep 12, 2016

Looks like part of the problem is setWorkingDirectory which is using windows format. I created a pull request for that: #222

@rnorth
Copy link
Member

rnorth commented Sep 14, 2016

Thanks - will review and hopefully merge this weekend.
On Mon, 12 Sep 2016 at 08:21, scetix notifications@github.com wrote:

Looks like part of the problem is setWorkingDirectory which is using
windows format. I created a pull request for that: #222
#222


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#221 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIETwIukk3T-cRIZQ278NZu-psrK7S6ks5qpP1wgaJpZM4J5q2P
.

Richard

@scetix
Copy link
Contributor Author

scetix commented Sep 15, 2016

I fixed the issue by using MinGW compatible paths on docker side without the leading /
#224

@bsideup
Copy link
Member

bsideup commented Jan 23, 2017

Since you fixed the issue in #224, I think we can close it :) Thanks!

@bsideup bsideup closed this as completed Jan 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants