-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Module
Core
Proposal
Right now the RYUK container image is pulled from public docker hub. People may fall in love with the resource reaper implementation and dont want to duplicate the entire code just for the sake of following two lines.
testcontainers-java/core/src/main/java/org/testcontainers/utility/RyukResourceReaper.java
Line 36 in b2b404a
| private final RyukContainer ryukContainer = new RyukContainer(); |
testcontainers-java/core/src/main/java/org/testcontainers/utility/RyukContainer.java
Line 12 in b2b404a
| super("testcontainers/ryuk:0.12.0"); |
I personally would love to keep using ryuk based resource reaper coming directly from the library, instead of the duplicating the source code and keep it in sync with the library.
In many organizations public docker images may not be allowed. A certain level of security and compliance checks must be done and images should only be kept in private registry. All test codes can only pull images from this private registry which will cause the problem since ryuk image is pointing to public registry.
If we allow overriding this, or at least follow dependency injection and logicless constructors for the classes
Workaround
Hack 1
Ask all teammates to update their local docker daemon registry mirrors for the organization's private artifactory.
Hack 2
Add a test setup code which will pull the testcontainers/ryuk:...sync_with_library_version... from the private registry and tag that properly in local docker daemon.
eg. docker java client sample code:
final var tag = "0.12.0";
dockerClient.pullImageCmd("testcontainers/ryuk:" + tag)
.start()
.awaitCompletion();
final var response = dockerClient.inspectImageCmd("testcontainers/ryuk:" + tag)
.exec();
dockerClient.tagImageCmd(response.getId(), "highly-secure.artifactory.my-employer.io/" + "testcontainers/ryuk", tag).exec();