Testcontainers-java: "Can not connect to Ryuk" on Win with Docker Desktop Edge 2.4.2.0

Created on 2 Nov 2020  ·  10Comments  ·  Source: testcontainers/testcontainers-java

Upgrade to the latest Docker Desktop Edge(2.4.2.0), and using Testcontainers 1.5.0-rc2.

❯ docker -v
Docker version 20.10.0-beta1, build ac365d7
````

When running my testing codes, failed with the following errors:

```bash
12:15:08.008 [testcontainers-ryuk] WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at localhost:49153
java.net.ConnectException: Connection refused: connect
    at java.base/sun.nio.ch.Net.connect0(Native Method)
    at java.base/sun.nio.ch.Net.connect(Net.java:574)
    at java.base/sun.nio.ch.Net.connect(Net.java:563)
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333)
    at java.base/java.net.Socket.connect(Socket.java:648)
    at java.base/java.net.Socket.connect(Socket.java:597)
    at java.base/java.net.Socket.<init>(Socket.java:520)
    at java.base/java.net.Socket.<init>(Socket.java:294)
    at org.testcontainers.utility.ResourceReaper.lambda$null$1(ResourceReaper.java:133)
    at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
    at org.testcontainers.utility.ResourceReaper.lambda$start$2(ResourceReaper.java:131)
    at java.base/java.lang.Thread.run(Thread.java:832)
12:15:10.292 [testcontainers-ryuk] WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at localhost:49153

When inspect the docker errors, I got the following info:

2020/11/02 04:05:47 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

I am sure docker is running, and I can run other docker commands in Powershell/cmd.

Most helpful comment

Unfortunately I encounter this problem too.

Windows 10
Docker Desktop 3.1.0
Test Container Version 1.15.1

17:20:36 I [      main]   o.t.DockerClientFactory : Connected to docker: 
  Server Version: 20.10.2
  API Version: 1.41
  Operating System: Docker Desktop
  Total Memory: 25520 MB
17:20:36 I [      main] .t.u.ImageNameSubstitutor : Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
17:20:39 W [iners-ryuk]      o.t.u.ResourceReaper : Can not connect to Ryuk at localhost:49154
java.net.ConnectException: Connection refused: connect

Ryuk's container logs:

2021/01/20 16:20:37 Pinging Docker...
2021/01/20 16:20:37 Docker daemon is available!
2021/01/20 16:20:37 Starting on port 8080...
2021/01/20 16:20:37 Started!

Are there any solutions / workarounds so far?

Edit:
I could solve it running netcfg -d described in https://github.com/testcontainers/testcontainers-java/issues/3609#issuecomment-756098790
Caution: netcfg -d Performs a cleanup on all networking devices. This will require a reboot.
Edit2:
https://github.com/docker/for-win/issues/3171 addresses this in Docker for Windows.
powershell restart-service winnat helps temporarily as netcfg -d didn't solve it permanently.

All 10 comments

I just tried out Docker Desktop Edge 2.4.2.0 on Windows 10 1904 with WSL2 backend and can't reproduce the error.
Which engine backend are you using?

And this error happened after the update to Edge?

Image 1

I was using Windows 10 Pro 64bit insider build 20246, not sure if it is the system problem

Reinstall Docker, and purge all data, it is disappeared

In my case setup was hanging during Docker uninstallation so computer reboot was required.

I'm having a similar problem. Does anyone have any idea? It just keeps trying to connect until it aborts.

Windows 10
Docker Desktop 3.0.0
Test Container Version 1.15.1

21:29:20.394 [main] DEBUG org.testcontainers.shaded.com.github.dockerjava.core.exec.InspectContainerCmdExec - GET: DefaultWebTarget{path=[/containers/5409773a80d2342cbdc6a5c1b9533749bd23c7dc837d8378575e49c4bee70222/json], queryParams={}}
21:29:22.593 [testcontainers-ryuk] WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at localhost:55005
java.net.ConnectException: Connection refused: connect
    at java.base/java.net.PlainSocketImpl.connect0(Native Method)
....

Ryuk's container logs:

2020/12/20 00:31:50 Pinging Docker...
2020/12/20 00:31:50 Docker daemon is available!
2020/12/20 00:31:50 Starting on port 8080...
2020/12/20 00:31:50 Started!

I have exactly the same problem and configuration as @wallysoncarvalho, did you find a solution ?

Same problem here...

Same problem here...

Just so you know, I couldn't come up with any solution other than downgrade

Unfortunately I encounter this problem too.

Windows 10
Docker Desktop 3.1.0
Test Container Version 1.15.1

17:20:36 I [      main]   o.t.DockerClientFactory : Connected to docker: 
  Server Version: 20.10.2
  API Version: 1.41
  Operating System: Docker Desktop
  Total Memory: 25520 MB
17:20:36 I [      main] .t.u.ImageNameSubstitutor : Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
17:20:39 W [iners-ryuk]      o.t.u.ResourceReaper : Can not connect to Ryuk at localhost:49154
java.net.ConnectException: Connection refused: connect

Ryuk's container logs:

2021/01/20 16:20:37 Pinging Docker...
2021/01/20 16:20:37 Docker daemon is available!
2021/01/20 16:20:37 Starting on port 8080...
2021/01/20 16:20:37 Started!

Are there any solutions / workarounds so far?

Edit:
I could solve it running netcfg -d described in https://github.com/testcontainers/testcontainers-java/issues/3609#issuecomment-756098790
Caution: netcfg -d Performs a cleanup on all networking devices. This will require a reboot.
Edit2:
https://github.com/docker/for-win/issues/3171 addresses this in Docker for Windows.
powershell restart-service winnat helps temporarily as netcfg -d didn't solve it permanently.

SOLUTION: after running netcfg -d from https://github.com/docker/for-win/issues/3171#issuecomment-731096674 and rebooting computer, testcontainers works again. Windows woodoo detected 👻

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ayedo picture ayedo  ·  3Comments

vmassol picture vmassol  ·  3Comments

rnorth picture rnorth  ·  3Comments

lovepoem picture lovepoem  ·  3Comments

michael-simons picture michael-simons  ·  3Comments