testcontainers / testcontainers/testcontainers-java
Error when pulling testcontainers/ryuk not enough explicit
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 9
説明
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)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
DockerClientFactory.java の checkAndPullImage 付近と ResourceReaper.java の start 付近を読み、その後 LoggedPullImageResultCallback.java を調べます。ContainerCheckerTest の失敗を再現し、pull 操作を追跡します。pull 関連のエラーで要求されたイメージが明確に特定され、既存のテスト動作が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, java
- 領域
- devops, testing
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100