{"record":{"id":"b87f14df423ee0ae","repo":"testcontainers/testcontainers-java","slug":"can-not-connect-to-ryuk-at","errorCode":null,"errorMessage":"Can not connect to Ryuk at {}:{}","messagePattern":"Can not connect to Ryuk at (.+?):(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/testcontainers/utility/RyukResourceReaper.java","lineNumber":120,"sourceCode":"                                            ResourceReaper.DEATH_NOTE.wait(1_000);\n                                            continue;\n                                        } catch (InterruptedException e) {\n                                            throw new RuntimeException(e);\n                                        }\n                                    }\n                                    List<Map.Entry<String, String>> filters = ResourceReaper.DEATH_NOTE.get(index);\n                                    boolean isAcknowledged = registry.register(filters);\n                                    if (isAcknowledged) {\n                                        log.debug(\"Received 'ACK' from Ryuk\");\n                                        ryukScheduledLatch.countDown();\n                                        index++;\n                                    } else {\n                                        log.debug(\"Didn't receive 'ACK' from Ryuk. Will retry to send filters.\");\n                                    }\n                                }\n                            }\n                        } catch (IOException e) {\n                            log.warn(\"Can not connect to Ryuk at {}:{}\", host, ryukPort, e);\n                        }\n                    });\n                }\n            },\n            \"testcontainers-ryuk\"\n        );\n        kiraThread.setDaemon(true);\n        kiraThread.start();\n        // We need to wait before we can start any containers to make sure that we delete them\n        if (!ryukScheduledLatch.await(TestcontainersConfiguration.getInstance().getRyukTimeout(), TimeUnit.SECONDS)) {\n            log.error(\"Timed out waiting for Ryuk container to start. Ryuk's logs:\\n{}\", ryukContainer.getLogs());\n            throw new IllegalStateException(String.format(\"Could not connect to Ryuk at %s:%s\", host, ryukPort));\n        }\n    }\n}\n","sourceCodeStart":102,"sourceCodeEnd":136,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/core/src/main/java/org/testcontainers/utility/RyukResourceReaper.java#L102-L136","documentation":"RyukResourceReaper.maybeStart opens a socket to the Ryuk sidecar container to register cleanup filters. When connecting fails with an IOException, this warning is logged (inside an executor thread) and filter registration is retried/abandoned. Ryuk handles automatic container cleanup after the JVM exits; failure to connect means automatic reaping may not work for this session.","triggerScenarios":"Ryuk container not started or crashed; TESTCONTAINERS_RYUK_DISABLED misconfiguration; network unreachable between JVM and Ryuk (custom networks, firewall, remote Docker host); Ryuk port not yet exposed when the first filter registration happens.","commonSituations":"Remote Docker (DOCKER_HOST over TCP/ssh) where the mapped Ryuk port isn't routable from the client; corporate proxies blocking the connection; Ryuk image pull failure leaving the helper container down; IPv6 vs IPv4 mismatch on localhost.","solutions":["Check the Ryuk container status (`docker ps | grep ryuk`) and its logs for startup failures","Set TESTCONTAINERS_HOST_OVERRIDE or verify ryuk.container.image / TESTCONTAINERS_RYUK_DISABLED settings in ~/.testcontainers.properties","Ensure the host running tests can reach the port Ryuk is mapped to on the Docker host (critical for remote Docker)","Update the Testcontainers version — newer releases have more robust Ryuk connection/retry handling","Set TESTCONTAINERS_RYUK_DISABLED=true as a workaround and clean up containers manually"],"exampleFix":"// before: relying on Ryuk behind an unreachable remote Docker host\ndefault behavior (ryuk enabled)\n// after: ~/.testcontainers.properties\nryuk.disabled=true\n// and add a @AfterAll stopAll in tests:\n@AfterAll static void cleanup() { RyukResourceReaper.instance().performCleanup(); }","handlingStrategy":"retry","validationCode":"// probe reachability before relying on Ryuk\ntry (Socket s = new Socket()) { s.connect(new InetSocketAddress(ryukHost, ryukPort), 2000); return true; } catch (IOException e) { return false; }","typeGuard":null,"tryCatchPattern":"try (Socket socket = new Socket(host, ryukPort)) { /* register filters */ } catch (IOException e) { log.warn(\"Ryuk unreachable, falling back to manual cleanup\"); }","preventionTips":["Verify the test host can reach the Docker host's mapped Ryuk port (especially remote DOCKER_HOST)","Keep TESTCONTAINERS_RYUK_DISABLED consistent between local and CI","Check Ryuk container logs when connection warnings appear","Add manual container cleanup (@AfterAll / Reaper) as a fallback in CI"],"tags":["ryuk","network","connection","docker"],"backgroundTag":"connection-refused","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}