testcontainers / testcontainers/testcontainers-java
Error when pulling testcontainers/ryuk not enough explicit
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
Hello,
I finally understood an error that I had for a long time. In fact, when using testcontainers on computers accessing internet through a specific corporate proxy I had the error below. But I could not understand why testcontainers was trying to access the docker hub as I specifically specified an image in my own private registry.
What I've just understood is that testcontainers first tries to download the testcontainers/ryuk image (from docker hub). But the error below does not mention "testcontainers/ryuk" so I had no idea.
My request is to improve the logs so that people know at least what image is being pulled. Moreover, I can imagine that I will face the error next time testcontiners is upgraded and requires a new version of testcontainers/ryuk ! I hope I will remember the solution ;)
For the record, if people have the same error, you can avoid it by:
- configuring the TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX env variable to point to your private registry
- publish the testcontainers/ryuk image to your own registry with those commands:
docker pull testcontainers/ryuk:0.3.0
docker tag testcontainers/ryuk:0.3.0 harbor.xxx/third-parties/testcontainers/ryuk:0.3.0
docker push harbor.xxx/third-parties/testcontainers/ryuk:0.3.0
Here are the original logs, not very clear:
17:47:50.872 INFO [main] (DockerClientProviderStrategy.java:158) Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
17:47:50.914 INFO [main] (DockerClientFactory.java:180) Docker host IP address is 172.17.0.1
17:47:50.950 INFO [main] (DockerClientFactory.java:192) Connected to docker:
Server Version: 1.13.1
API Version: 1.26
Operating System: CentOS Linux 7 (Core)
Total Memory: 19916 MB
17:47:50.961 INFO [main] (ImageNameSubstitutor.java:50) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
17:47:51.109 INFO [docker-java-stream-1335806995] (LoggedPullImageResultCallback.java:38) Starting to pull image
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.012 s <<< FAILURE! - in com.xxx.container.ContainerCheckerTest
[ERROR] test(com.xxx.container.ContainerCheckerTest) Time elapsed: 3.005 s <<< ERROR!
com.github.dockerjava.api.exception.DockerClientException: Could not pull image: Get https://registry-1.docker.io/v2/: x509: certificate signed by unknown authority
at com.github.dockerjava.api.command.PullImageResultCallback.checkDockerClientPullSuccessful(PullImageResultCallback.java:97)
at com.github.dockerjava.api.command.PullImageResultCallback.throwFirstError(PullImageResultCallback.java:112)
at com.github.dockerjava.api.async.ResultCallbackTemplate.awaitCompletion(ResultCallbackTemplate.java:93)
at org.testcontainers.images.TimeLimitedLoggedPullImageResultCallback.awaitCompletion(TimeLimitedLoggedPullImageResultCallback.java:52)
at org.testcontainers.DockerClientFactory.checkAndPullImage(DockerClientFactory.java:334)
at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:93)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:205)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read DockerClientFactory.java around checkAndPullImage and ResourceReaper.java around start, then inspect LoggedPullImageResultCallback.java. Reproduce the failure from ContainerCheckerTest and trace the pull operation. Done means pull-related errors clearly identify the image being requested while the existing test behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- devops, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100