Testcontainers-java: Unable to run tests with latest docker for mac

Created on 30 Sep 2020  ·  6Comments  ·  Source: testcontainers/testcontainers-java

Hi

I have installed latest docker for mac and after that my local tests started to fail with the following error:

12:23:33.030 [testcontainers-ryuk] WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at localhost:32769
java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at java.net.Socket.<init>(Socket.java:434)
        at java.net.Socket.<init>(Socket.java:211)
        at org.testcontainers.utility.ResourceReaper.lambda$null$1(ResourceReaper.java:138)
        at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
        at org.testcontainers.utility.ResourceReaper.lambda$start$2(ResourceReaper.java:136)
        at java.lang.Thread.run(Thread.java:748)
Results: FAILURE -->  77 tests ( 76 successes, 1 failures, 0 skipped ) 
....
....

12:16:02.228 [main] ERROR o.t.utility.ResourceReaper - Timeout out waiting for Ryuk. Ryuk's log:
2020/09/30 11:15:32 Pinging Docker...
panic: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

goroutine 1 [running]:
main.main()
        /go/src/github.com/testcontainers/moby-ryuk/main.go:35 +0xcf5

....
....
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 com.tesco.favourites.infrastructure.service.TpnbDecorationCacheSpec.setupSpec(TpnbDecorationCacheSpec.groovy:28)
Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=redis:5.0.3-alpine, imagePullPolicy=DefaultPullPolicy())
    at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1279)
    at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:613)
    at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:320)
    ... 2 more
Caused by: java.lang.IllegalStateException: Can not connect to Ryuk at localhost:32768
    at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:176)
    at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:168)
    at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
    at org.testcontainers.LazyDockerClient.listImagesCmd(LazyDockerClient.java:12)
    at org.testcontainers.images.LocalImagesCache.maybeInitCache(LocalImagesCache.java:68)
    at org.testcontainers.images.LocalImagesCache.get(LocalImagesCache.java:32)
    at org.testcontainers.images.AbstractImagePullPolicy.shouldPull(AbstractImagePullPolicy.java:18)
    at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:59)
    at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:26)
    at org.testcontainers.utility.LazyFuture.getResolvedValue(LazyFuture.java:20)
    at org.testcontainers.utility.LazyFuture.get(LazyFuture.java:27)
    at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1277)
    ... 4 more

The latest docker version I tried was:

/tmp/ListService➜  ListService git:(master) docker version
Client: Docker Engine - Community
 Cloud integration  0.1.18
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 16:58:31 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:07:04 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

I had to downgrade docker to this one to get it working:

/tmp/ListService➜  ListService git:(master) docker version
Client: Docker Engine - Community
 Azure integration  0.1.15
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:41:33 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:49:27 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Most helpful comment

I ran into the same issue. Same Docker-for-Mac version.

By trial and error I also found a solution.
Solution for me was to disable "Use gRPC FUSE for file sharing" in Preferences:

image

All 6 comments

I ran into the same issue. Same Docker-for-Mac version.

By trial and error I also found a solution.
Solution for me was to disable "Use gRPC FUSE for file sharing" in Preferences:

image

Fixed in #3159 and released in 1.15.0-rc2

Also, this is a duplicate of #3166

I ran into the same issue. Same Docker-for-Mac version.

By trial and error I also found a solution.
Solution for me was to disable "Use gRPC FUSE for file sharing" in Preferences:

image

Thank you for this! Coudl you please explain to me what this setting is and why it had affect on this problem?

@javaHelena please see #3166!

I'm going to lock this issue and refer people to look at #3166, as it's confusing to have conversation spread across multiple tickets

Was this page helpful?
0 / 5 - 0 ratings