Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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);
}
like image 930
user1870400 Avatar asked May 05 '21 12:05

user1870400


2 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

like image 96
Olavi Vaino Avatar answered Nov 10 '22 23:11

Olavi Vaino


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

like image 8
Anmol moses Avatar answered Nov 10 '22 23:11

Anmol moses