You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/create_docker_container.md
+11-13Lines changed: 11 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Both `ENTRYPOINT` and `CMD` allows you to configure an executable and parameters
9
9
Instead of running the NGINX application, the following container configuration overrides the default start procedure of the image and just tests the NGINX configuration file.
10
10
11
11
```csharp
12
-
_=newContainerBuilder()
12
+
_=newContainerBuilder("nginx:1.26.3-alpine3.20")
13
13
.WithEntrypoint("nginx")
14
14
.WithCommand("-t");
15
15
```
@@ -25,7 +25,7 @@ Apps or services running inside a container are usually configured either with e
25
25
To configure an ASP.NET Core application, either one or both mechanisms can be used.
Sometimes it is necessary to copy files into the container to configure the services running inside the container in advance, like the `appsettings.json` or an SSL certificate. The container builder API provides a member `WithResourceMapping(string, string)`, including several overloads to copy directories or individual files to a container's directory.
// Copy 'appsettings.Container.json' to '/app/appsettings.Developer.json'.
@@ -54,7 +54,7 @@ _ = new ContainerBuilder()
54
54
Another overloaded member of the container builder API allows you to copy the contents of a byte array to a specific file path within the container. This can be useful when you already have the file content stored in memory or when you need to dynamically generate the file content before copying it.
When copying files into a container, you can specify the user ID (UID) and group ID (GID) to set the correct ownership of the copied files. This is particularly useful when the container runs as a non-root user or when specific file permissions are required for security or application functionality.
64
64
65
65
```csharp title="Copying a file with specific UID and GID"
Copy file name to clipboardExpand all lines: docs/api/resource_reuse.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,14 @@
3
3
Reuse is an experimental feature designed to simplify and enhance the development experience. Instead of disposing resources after the tests are finished, enabling reuse will retain the resources and reuse them in the next test run. Testcontainers assigns a hash value according to the builder configuration. If it identifies a matching resource, it will reuse this resource instead of creating a new one. Enabling reuse will disable the resource reaper, meaning the resource will not be cleaned up.
4
4
5
5
```csharp title="Enable container reuse"
6
-
_=newContainerBuilder()
6
+
_=newContainerBuilder("alpine:3.20.0")
7
7
.WithReuse(true);
8
8
```
9
9
10
10
The reuse implementation does currently not consider (support) all builder APIs when calculating the hash value. Therefore, collisions may occur. To prevent collisions, simply use a distinct label to identify the resource.
11
11
12
12
```csharp title="Label container resource to identify it"
0 commit comments