testcontainers / testcontainers/testcontainers-java

Error when pulling testcontainers/ryuk not enough explicit

Offen
#4,923 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Java
Sterne
8.7k
Forks
1.9k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
9

Beschreibung

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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Lies DockerClientFactory.java im Umfeld von checkAndPullImage und ResourceReaper.java im Umfeld von start und untersuche anschließend LoggedPullImageResultCallback.java. Reproduziere den Fehler aus ContainerCheckerTest und verfolge die Pull-Operation. Erledigt ist die Aufgabe, wenn Pull-bezogene Fehler das angeforderte Image eindeutig identifizieren und das bestehende Testverhalten unverändert bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
docker, java
Bereich
devops, testing
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.