diff --git a/docs/api/create_docker_image.md b/docs/api/create_docker_image.md index d67509f88..e5fa58d60 100644 --- a/docs/api/create_docker_image.md +++ b/docs/api/create_docker_image.md @@ -60,7 +60,7 @@ As the tarball's content is based on `/Users/testcontainers/WeatherForecast/`, a To improve the build time and to reduce the size of the image, it is recommended to include only necessary files. Exclude unnecessary files or directories such as `bin/`, `obj/` and `tests/` with the `.dockerignore` file. -```Dockerfile +```dockerfile FROM mcr.microsoft.com/dotnet/sdk:6.0 ARG SLN_FILE_PATH="WeatherForecast.sln" COPY . . @@ -86,7 +86,7 @@ A multi-stage Docker image build generates intermediate layers that serve as cac The following Dockerfile assigns the `org.testcontainers.resource-reaper-session` label to each stage. -```Dockerfile +```dockerfile FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env-1 ARG RESOURCE_REAPER_SESSION_ID="00000000-0000-0000-0000-000000000000" LABEL "org.testcontainers.resource-reaper-session"=$RESOURCE_REAPER_SESSION_ID @@ -127,7 +127,7 @@ _ = new ImageFromDockerfileBuilder() - When building an image using Testcontainers for .NET and switching the user's context (`USER` statement) in a Dockerfile, the user won't automatically become the [owner](https://github.com/testcontainers/testcontainers-dotnet/issues/1171#issuecomment-2099197840) of the working directory, which seems to be the case when building the image from the CLI. If the running process requires write access to the working directory, it is necessary to set the permissions explicitly (the base image in this example already contains the user `app`): - ```Dockerfile + ```dockerfile FROM mcr.microsoft.com/dotnet/sdk:8.0 WORKDIR /app RUN chown app:app . diff --git a/docs/api/resource_reaper.md b/docs/api/resource_reaper.md index 85328d94b..5e9c8aea4 100644 --- a/docs/api/resource_reaper.md +++ b/docs/api/resource_reaper.md @@ -8,6 +8,49 @@ Testcontainers automatically assigns a Resource Reaper session id to each Docker Moby Ryuk derives its name from the anime character [Ryuk](https://en.wikipedia.org/wiki/Ryuk_(Death_Note)) 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: + +```text +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`](https://github.com/containers/skopeo): + +=== "Linux/macOS" + ```shell + skopeo \ + copy \ + --all \ + --preserve-digests \ + docker://docker.io/testcontainers/ryuk@sha256:7c1a8a9a47c780ed0f983770a662f80deb115d95cce3e2daa3d12115b8cd28f0 \ + docker://registry.mycompany.com/testcontainers/ryuk:0.14.0 + ``` + +=== "Windows" + ```powershell + # 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: + +```shell +TESTCONTAINERS_RYUK_CONTAINER_IMAGE=registry.mycompany.com/testcontainers/ryuk:0.14.0 +``` +