google jib maven plugin, Build image failed初步解决

D:\source\guns\guns-admin>mvn compile jib:build

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building guns-admin 1.0.0

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ guns-admin ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] Copying 181 resources

[INFO] Copying 4 resources

[INFO] Copying 10 resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ guns-admin ---

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- jib-maven-plugin:0.9.8:build (default-cli) @ guns-admin ---

[WARNING] 'mainClass' is not a valid Java class : ${start-class}

[WARNING] Base image 'gcr.io/distroless/java' does not use a specific image digest - build may not be reproducible

[INFO]

[INFO] Containerizing application to XXXX.XXX.XX.XX:9981/spring/guns-admin:0.1...

[INFO]

[INFO] Retrieving registry credentials for XXXX.XXX.XX.XX:9981...

[INFO] Building classes layer...

[INFO] Building resources layer...

[INFO] Building dependencies layer...

[INFO] Getting base image gcr.io/distroless/java...

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 29.406 s

[INFO] Finished at: 2018-08-16T17:29:27+08:00

[INFO] Final Memory: 35M/321M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.8:build (default-cli) on project guns-admin: Build image failed: Connect to gcr.io/108.177.125.82:443 timed out -> [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



通过设置代理的方法还是没有解决

用了设置代理 set HTTP_PROXY=http://127.0.0.1:1080

根据 Build image failed #544 的描述,from 镜像改用openjdk:8-jre-alpine,在auth设置hub.docker.com账户信息。

由于我配置的私有镜像仓库没有设置https,所以设置true


再重新运行mvn compile jib:build,即可build成功了。

D:\source\guns\guns-admin>mvn compile jib:build

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building guns-admin 1.0.0

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ guns-admin ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] Copying 181 resources

[INFO] Copying 4 resources

[INFO] Copying 10 resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ guns-admin ---

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- jib-maven-plugin:0.9.8:build (default-cli) @ guns-admin ---

[WARNING] 'mainClass' is not a valid Java class : ${start-class}

[INFO]

[INFO] Containerizing application to XXXX.XXX.XX.XX:9981/guns-admin:0.1...

[INFO]

[INFO] Retrieving registry credentials for XXXX.XXX.XX.XX:9981...

[INFO] Getting base image openjdk:8-jre-alpine...

[INFO] Building dependencies layer...

[INFO] Building classes layer...

[INFO] Building resources layer...

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256:0450804ad14e232495e648ac35e90c6ddb1ab5355ddbbe3dadfd77de1cd15af6 over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256

:0450804ad14e232495e648ac35e90c6ddb1ab5355ddbbe3dadfd77de1cd15af6

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256:01d060ececba83405757973c2f0c65c70eef1cac19f020f8f9e8b4d437d834d6 over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256

:01d060ececba83405757973c2f0c65c70eef1cac19f020f8f9e8b4d437d834d6

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256:ee8c19e4413e85cd4fc9f8c34870d66c1014d8294a6945e478d5ccd5cbdc088d over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256

:ee8c19e4413e85cd4fc9f8c34870d66c1014d8294a6945e478d5ccd5cbdc088d

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/

[INFO] The base image requires auth. Trying again for openjdk:8-jre-alpine...

[INFO] Retrieving registry credentials for registry.hub.docker.com...

[INFO] Finalizing...

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256:8e3ba11ec2a2b39ab372c60c16b421536e50e5ce64a0bc81765c2e38381bcff6 over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256

:8e3ba11ec2a2b39ab372c60c16b421536e50e5ce64a0bc81765c2e38381bcff6

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256:391a6a6b36513d84d55cbbe7e13bca7e92fbf257d910a5255f2b7bc9fcff4edf over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256

:391a6a6b36513d84d55cbbe7e13bca7e92fbf257d910a5255f2b7bc9fcff4edf

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256:311ad0da45338842480bf25c6e6b7bb133b7b8cf709c3470db171ec370da5539 over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256

:311ad0da45338842480bf25c6e6b7bb133b7b8cf709c3470db171ec370da5539

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256:eb147fcb3225e019310856d267dfc7e5f25e4708d9f438ab6f3189ced773451f over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/sha256

:eb147fcb3225e019310856d267dfc7e5f25e4708d9f438ab6f3189ced773451f

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/ over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/blobs/uploads/

[WARNING] Failed to connect to https://XXXX.XXX.XX.XX:9981/v2/guns-admin/manifests/0.1 over HTTPS. Attempting again with HTTP: http://XXXX.XXX.XX.XX:9981/v2/guns-admin/manifests/0.1

[INFO]

[INFO] Container entrypoint set to [java, -cp, /app/libs/*:/app/resources/:/app/classes/, ${start-class}]

[INFO]

[INFO] Built and pushed image as ?[36mXXXX.XXX.XX.XX:9981/guns-admin:0.1?[0m

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 28.296 s

[INFO] Finished at: 2018-08-17T15:27:36+08:00

[INFO] Final Memory: 44M/330M

[INFO] ------------------------------------------------------------------------




私有镜像仓库中信息




要点小结:

1. 由于gcr.io被墙,gcr.io/distroless/java镜像不得到,建议用openjdk:8-jre-alpine代替

2. 如果私有镜像仓库没有启用https,设置allowInsecureRegistries参数为true

我的jib maven plugin配置如下


你可能感兴趣的:(google jib maven plugin, Build image failed初步解决)