java.lang.IllegalStateException: 无法连接到 localhost:49167 的 Ryuk

问题描述

我正在使用测试容器库来启动容器。它工作了一段时间,但目前遇到了这个

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)

我查看了资源收割者的代码,它似乎在这里失败了

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

解决方法

我遇到了同样的问题。相同的 Docker-for-Mac 版本。

我的解决方案是在首选项中禁用“使用 gRPC FUSE 进行文件共享”:Preferences