What is Jib A tool that can be defined as a Maven or Gradle plugin, create a Docker image without using the Docker daemon, and push it to the registry.
Explain the procedure while writing the addictive part Addictive 1: proxy Addiction 2: Authentication
OS : Windows IDE : eclipse build : Maven jib-maven-plugin : 1.0.2
Have a docker hub account Create a Repository (this time I did it with the name test)
anything is fine. I dropped the following 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
For eclipse
![jib_02.png](https://qiita-image-store.s3.amazonaws.com/0/39442/bcdebe89-53ba-6489-c5d1-cca29dd10768.png)
Run on
## error!
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.0.2:build (default-cli) on project gs-rest-service:Subaru?Medical doctor ≧?荳 肴?Weak 〒?? (gcr.io): Unknown hostSubaru?Medical doctor ≧?荳 肴?Weak 〒?? (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
## Push again to Docker Hub remote registry through proxy
#### **`$ mvn -Dhttps.proxyHost=・ ・ ・-Dhttps.proxyPort=・ ・ ・-Dhttp.proxyHost=・ ・ ・-Dhttp.proxyPort=・ ・ ・compile jib:build`**
For eclipse Run on
[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>
The wind
[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] ------------------------------------------------------------------------
Confirm that it is also registered in docker hub
Recommended Posts