Qu'est-ce que Jib Un outil qui peut être défini comme un plug-in Maven ou Gradle, créer une image Docker sans utiliser le démon Docker et la pousser dans le registre.
Expliquez la procédure lors de l'écriture de la partie addictive Addictif 1: proxy Dépendance 2: Certification
OS : Windows IDE : eclipse build : Maven jib-maven-plugin : 1.0.2
Avoir un compte dockerhub Créer un référentiel (cette fois je l'ai fait avec le test de nom)
tout va bien. J'ai laissé tomber ce qui suit https://github.com/spring-guides/gs-rest-service.git
pom.xml
<build>
<plugins>
・ ・ ・
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>1.0.2</version>
<configuration>
<to>
<image>registry.hub.docker.com/{dockerhubId}/test</image>
</to>
</configuration>
</plugin>
</plugins>
</build>
build
Pour éclipse
![jib_02.png](https://qiita-image-store.s3.amazonaws.com/0/39442/bcdebe89-53ba-6489-c5d1-cca29dd10768.png)
Courir
## Erreur!
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.0.2:build (default-cli) on project gs-rest-service:Subaru?Médecin ≧?荳 肴?Faible 〒?? (gcr.io): Unknown hostSubaru?Médecin ≧?荳 肴?Faible 〒?? (gcr.io) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
## Pousser à nouveau vers le registre distant Docker Hub via un proxy
#### **`$ mvn -Dhttps.proxyHost=・ ・ ・-Dhttps.proxyPort=・ ・ ・-Dhttp.proxyHost=・ ・ ・-Dhttp.proxyPort=・ ・ ・compile jib:build`**
Pour éclipse Courir
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.0.2:build (default-cli) on project gs-rest-service: Build image failed, perhaps you should set a credential helper name with the configuration '<to><credHelper>' or set credentials for 'registry.hub.docker.com' in your Maven settings: Unauthorized for registry.hub.docker.com/{dockerhubId}/test: 401 Unauthorized
[ERROR] {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"{dockerhubId}/test","Action":"pull"},{"Type":"repository","Class":"","Name":"{dockerhuId}/test","Action":"push"}]}]}
[ERROR] -> [Help 1]
pom.xml
<build>
<plugins>
・ ・ ・
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>1.0.2</version>
<configuration>
<to>
<image>registry.hub.docker.com/{dockerhubId}/test</image>
<auth>
<username>{dockerhubId}</username>
<password>{password}</password>
</auth>
</to>
</configuration>
</plugin>
</plugins>
</build>
Le vent
[INFO] --- jib-maven-plugin:1.0.2:build (default-cli) @ gs-rest-service ---
[INFO]
[INFO] Containerizing application to [36m{dockerhubid}/test[0m...
[INFO] Retrieving registry credentials for registry.hub.docker.com...
[INFO] Getting base image gcr.io/distroless/java:8...
[INFO] Building dependencies layer...
[INFO] Building resources layer...
[INFO] Building classes layer...
[INFO]
[INFO] Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, hello.Application]
[INFO]
[INFO] Built and pushed image as [36m{dockerhubid}/test[0m
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.279 s
[INFO] Finished at: 2019-03-19T14:48:47+09:00
[INFO] ------------------------------------------------------------------------
Confirmez qu'il est également enregistré dans Docker Hub
Recommended Posts