java.lang.IllegalStateException: Could not connect to Ryuk at localhost:49167

Viewed 12217

I am using test containers library to launch a container. It worked for a while but currently running into this

java.lang.IllegalStateException: Could not connect to Ryuk at localhost:49167

    at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:201)
    at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:205)
    at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
    at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)

I looked at the resource reaper code and it seems like it is failing here

public synchronized void performCleanup() {
    this.registeredContainers.forEach(this::stopContainer);
    this.registeredNetworks.forEach(this::removeNetwork); //FAILS HERE
    this.registeredImages.forEach(this::removeImage);
}
4 Answers

I can confirm that this is resolved by updating testcontainers to 1.16.0 version

Was facing the same exception with testcontainers 1.15.3

Windows 10, Docker desktop 4.0.0

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

Solution for me was to disable "Use gRPC FUSE for file sharing" in Preferences: Preferences

I tried everything mentioned here but nothing worked. if anyone is still facing the issue they can give this one a try...this worked for me

this works for windows

  1. open you power shell in administrator mode.
  2. run "net stop winnat"
  3. run "net start winnat"

doing this resolved this issue on my setup. hope this helps someone

For me, restarting the local docker engine solved the problem

Related