Skip to content

Commit d623ddc

Browse files
authored
Merge pull request #287 from dddpaul/custom_tiny_image
Add ability to override DockerClientFactory.TINY_IMAGE in testcontainers.properties
2 parents 2b2d34f + c4a30d8 commit d623ddc

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

core/src/main/java/org/testcontainers/DockerClientFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import lombok.Synchronized;
1313
import lombok.extern.slf4j.Slf4j;
1414
import org.testcontainers.dockerclient.*;
15+
import org.testcontainers.utility.TestcontainersConfiguration;
1516

1617
import java.util.List;
1718
import java.util.Optional;
@@ -28,7 +29,7 @@
2829
@Slf4j
2930
public class DockerClientFactory {
3031

31-
private static final String TINY_IMAGE = "alpine:3.2";
32+
private static final String TINY_IMAGE = TestcontainersConfiguration.getInstance().getTinyImage();
3233
private static DockerClientFactory instance;
3334

3435
// Cached client configuration

core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class TestcontainersConfiguration {
2424

2525
private String ambassadorContainerImage = "richnorth/ambassador:latest";
2626
private String vncRecordedContainerImage = "richnorth/vnc-recorder:latest";
27+
private String tinyImage = "alpine:3.2";
2728

2829
private static TestcontainersConfiguration loadConfiguration() {
2930
final TestcontainersConfiguration config = new TestcontainersConfiguration();
@@ -42,6 +43,7 @@ private static TestcontainersConfiguration loadConfiguration() {
4243

4344
config.ambassadorContainerImage = properties.getProperty("ambassador.container.image", config.ambassadorContainerImage);
4445
config.vncRecordedContainerImage = properties.getProperty("vncrecorder.container.image", config.vncRecordedContainerImage);
46+
config.tinyImage = properties.getProperty("tinyimage.container.image", config.tinyImage);
4547

4648
log.debug("Testcontainers configuration overrides loaded from {}: {}", configOverrides, config);
4749

docs/usage.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ Testcontainers uses additional docker images under some modes of execution:
109109

110110
> *N.B.:* both these images use the 'latest' tag, which could potentially affect repeatability of tests and compatibility with Testcontainers _if the image is ever changed_. This is a [known issue](https://github.com/testcontainers/testcontainers-java/issues/276) which will be addressed in the future. The current 'latest' version of these images will never be changed until they are replaced by a new image altogether.
111111
112+
Last but not least, `alpine:3.2` image is used for Docker host IP address detection in some special cases.
113+
112114
If it is necessary to override these image names (e.g. when using a private registry), you should create a file named `testcontainers.properties` and place it on the classpath with the following content:
113115

114116
```properties
115117
ambassador.container.image=replacement image name here
116118
vncrecorder.container.image=replacement image name here
119+
tinyimage.container.image=replacement image name here
117120
```

0 commit comments

Comments
 (0)