Skip to content

Resource Reaper

Testcontainers automatically assigns a Resource Reaper session id to each Docker resource. After the tests are finished — whether they are successful or not — Moby Ryuk will take care of the remaining Docker resources and removes them. You can change the Resource Reaper session and group Docker resources together. Right now, only Linux containers are supported.

Tip

Whenever possible, do not disable the Resource Reaper. It keeps your machine and CI/CD environment clean. If at all, consider disabling the Resource Reaper only for environments that have a mechanism to cleanup Docker resources, e.g. ephemeral CI nodes.

Moby Ryuk derives its name from the anime character Ryuk and is a fitting choice due to the intriguing narrative of the anime Death Note.

Copy image to a private registry

Testcontainers for .NET pins the Ryuk image to this manifest list (image index) digest:

1
testcontainers/ryuk:0.14.0@sha256:7c1a8a9a47c780ed0f983770a662f80deb115d95cce3e2daa3d12115b8cd28f0

If you depend on a private registry, make the image available there either through a registry proxy (pull-through cache) or by copying it from Docker Hub with a tool that preserves the manifest list and all platform variants, for example skopeo:

1
2
3
4
5
6
skopeo \
  copy \
  --all \
  --preserve-digests \
  docker://docker.io/testcontainers/ryuk@sha256:7c1a8a9a47c780ed0f983770a662f80deb115d95cce3e2daa3d12115b8cd28f0 \
  docker://registry.mycompany.com/testcontainers/ryuk:0.14.0
1
2
3
4
5
6
7
8
9
# There's no Skopeo package for Windows.
docker run `
  --rm `
  quay.io/skopeo/stable:v1.22.0 `
  copy `
  --all `
  --preserve-digests `
  docker://docker.io/testcontainers/ryuk@sha256:7c1a8a9a47c780ed0f983770a662f80deb115d95cce3e2daa3d12115b8cd28f0 `
  docker://registry.mycompany.com/testcontainers/ryuk:0.14.0

Warning

Pulling, tagging, and pushing the image manually is not sufficient. That workflow creates a new manifest and only includes the platform variant pulled locally, breaking multi-architecture support.

If your registry cannot preserve the digest or you want to use a different image reference, set the TESTCONTAINERS_RYUK_CONTAINER_IMAGE environment variable:

1
TESTCONTAINERS_RYUK_CONTAINER_IMAGE=registry.mycompany.com/testcontainers/ryuk:0.14.0