Replies: 2 comments
-
|
This is by design! Here's why: Ryuk (ResourceReaper) is the cleanup safety net. Its job is to ensure that Docker resources (containers, networks, volumes) created by Testcontainers are cleaned up even if your JVM crashes or tests are killed. When you call labels.putAll(ResourceReaper.instance().getLabels());Calling Why not defer Ryuk until a container starts? If you want to avoid early Ryuk startup:
The overhead of Ryuk starting early is minimal (~1-2s, ~12MB RAM). It's a small price for guaranteed cleanup. |
Beta Was this translation helpful? Give feedback.
-
|
This is by design, and the reason is important: Ryuk needs to know about every Docker resource from the moment it is created, not just containers. When you call Why this matters even with reuse enabled: If you need to avoid Ryuk (e.g., CI environments with their own cleanup), you can disable it globally: # testcontainers.properties
ryuk.disabled=trueOr via environment variable: Disabling Ryuk means you are responsible for cleaning up Docker resources if the JVM exits abnormally. For ephemeral CI runners this is fine, but for local development it can leave orphaned networks and containers. There is no API to selectively prevent Ryuk from starting for one specific |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m seeing
testcontainers/ryukstart as soon as I create a custom network, even when launching a single container. InCreateNetworkCmdsetup, Testcontainers callsResourceReaper.instance().getLabels()toadd cleanup labels:
This call appears to initialize ResourceReaper, which starts Ryuk even when reuse is enabled. Is this expected? Is there a way to avoid starting Ryuk when creating a network (without globally disabling Ryuk or relying on reuse)?
Beta Was this translation helpful? Give feedback.
All reactions