Skip to content

Commit 6c5b160

Browse files
authored
docs: Explain how to substitute the Docker Hub registry (#1503)
1 parent 0d70d46 commit 6c5b160

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/custom_configuration/index.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,36 @@ Setting the context to `tcc` in this example will use the Docker host running at
6060
docker.context=tcc
6161
```
6262

63+
## Automatically modify Docker Hub image names
64+
65+
Testcontainers can automatically add a registry prefix to Docker Hub image names used in your tests. This is handy if you use a private registry that mirrors Docker Hub images with predictable naming.
66+
67+
You can set this up in two ways:
68+
69+
=== "Environment Variable"
70+
```
71+
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX=registry.mycompany.com/mirror/
72+
```
73+
74+
=== "Properties File"
75+
```
76+
hub.image.name.prefix=registry.mycompany.com/mirror/
77+
```
78+
79+
Once configured, Testcontainers will rewrite Docker Hub image names by adding the prefix.
80+
81+
For example, the image:
82+
83+
```
84+
testcontainers/helloworld:1.2.0
85+
```
86+
87+
will automatically become:
88+
89+
```
90+
registry.mycompany.com/mirror/testcontainers/helloworld:1.2.0
91+
```
92+
6393
## Enable logging
6494

6595
In .NET logging usually goes through the test framework. Testcontainers is not aware of the project's test framework and may not forward log messages to the appropriate output stream. The default implementation forwards log messages to the `Console` (respectively `stdout` and `stderr`). The output should at least pop up in the IDE running tests in the `Debug` configuration. To override the default implementation, use the builder's `WithLogger(ILogger)` method and provide an `ILogger` instance to replace the default console logger.

0 commit comments

Comments
 (0)