Testcontainers-java: DockerException: Mounts denied: EOF

Created on 4 Jun 2018  路  7Comments  路  Source: testcontainers/testcontainers-java

I'm trying to use the Testcontainers library in my test but keep getting the following error:

com.github.dockerjava.api.exception.DockerException: Mounts denied: EOF

  at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:111)
  at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:33)
  at org.testcontainers.shaded.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
  at org.testcontainers.shaded.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
  at org.testcontainers.shaded.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
  at org.testcontainers.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
  at org.testcontainers.shaded.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
  at org.testcontainers.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1342)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
  at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
  at org.testcontainers.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:934)
  at org.testcontainers.shaded.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
  at org.testcontainers.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
  at org.testcontainers.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
  at org.testcontainers.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
  at org.testcontainers.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
  at org.testcontainers.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
  at org.testcontainers.shaded.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
  at java.lang.Thread.run(Thread.java:745)

The test itself is as simple as can be:

public class FirstTest {
    @Rule
    public GenericContainer container =
            new GenericContainer("postgres:9.6.9");

    @Test
    public void test() {
        System.out.println(container.getContainerId());
    }
}

I cloned the testcontainers-java-examples project and saw the same error when running the tests there.

The following snippet is what testcontainers deduced about my environment:

14:52:31.892 [main] INFO org.testcontainers.DockerClientFactory - Connected to docker: 
  Server Version: 18.03.1-ce
  API Version: 1.37
  Operating System: Docker for Mac
  Total Memory: 1998 MB
cliendocker-for-mac omacOS resolutioinvalid

Most helpful comment

Hi @haasted,

Please make sure that both /private and /tmp are shared in your Docker for Mac config:
screen shot 2018-06-04 at 15 05 31

All 7 comments

Hi @haasted,

Please make sure that both /private and /tmp are shared in your Docker for Mac config:
screen shot 2018-06-04 at 15 05 31

@bsideup : Thanks for the quick reply! Adding ' /private' did indeed resolve the issue. I'm very grateful.

Why is that directory needed by testcontainers, though? My short research into its purpose makes it seem like something very OS-internal that probably shouldn't be tampered with too much.

@haasted when did you install Docker for Mac? That should be a default option, not sure why it wasn't like this for you o_O

@bsideup : My installation is probably the result of a long series of incremental upgrades going back to docker-machine etc, so that might explain why it was missing. Thanks again for your help.

@haasted ok, that explains :) Should we close this issue as invalid then? :)

@bsideup : Sure, you can do that.

@haasted thanks for reporting! I hope the issue will stay as a good, google-able hint for the users who did the same to their Docker for Mac installations :)

Was this page helpful?
0 / 5 - 0 ratings