Manages the Ryuk reaper container for automatic cleanup of test containers.
Ryuk is a sidecar container that watches for labeled containers and removes them when the test process exits. It is started during GenServer init and registered with a filter matching the current session.
Summary
Functions
Returns whether Ryuk should run in privileged mode.
Starts the Ryuk reaper and registers the session filter.
Starts a host-based reaper that watches for labeled containers and removes them when the test process exits.
Stops the host-based reaper for a given session.
Functions
Returns whether Ryuk should run in privileged mode.
Checks TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED env var first,
then ryuk.container.privileged property. Values "true" and "1"
are truthy. The env var takes precedence.
@spec start(Tesla.Env.client(), String.t(), map(), String.t(), String.t()) :: {:ok} | {:error, term()}
Starts the Ryuk reaper and registers the session filter.
Returns {:ok} on success or {:error, reason} on failure.
Ryuk failures are non-fatal — tests can still run without auto-cleanup.
@spec start_host_reaper(Tesla.Env.client(), String.t(), map()) :: {:ok} | {:error, term()}
Starts a host-based reaper that watches for labeled containers and removes them when the test process exits.
On macOS with Colima/Docker Desktop, the Ryuk container can't reach the Docker daemon inside the VM. This function runs the reaper logic directly on the host process instead.
Returns {:ok} on success or {:error, reason} on failure.
Stops the host-based reaper for a given session.