testcontainers / testcontainers/testcontainers-java

Error when pulling testcontainers/ryuk not enough explicit

Aperta
#4,923 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Java
Stelle
8.7k
Fork
1.9k
Merge medio
2g 17h
PR unite (30g)
9

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Leggi DockerClientFactory.java nell’area di checkAndPullImage e ResourceReaper.java nell’area di start, quindi esamina LoggedPullImageResultCallback.java. Riproduci il fallimento di ContainerCheckerTest e traccia l’operazione di pull. Il lavoro è completato quando gli errori relativi al pull identificano chiaramente l’immagine richiesta, mantenendo invariato il comportamento esistente dei test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
docker, java
Ambito
devops, testing
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.