jib-maven-plugin I/O 图像 [registry-1.docker.io/library/adoptopenjdk] 错误

jib-maven-plugin I/O error for image [registry-1.docker.io/library/adoptopenjdk]

我开发了一个 Dockerized Spring 引导应用程序,使用 AdoptOpenJDK 作为基础映像并使用 jib-maven-plugin

我的插件配置是:

                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>${jib-maven-plugin.version}</version>
                    <configuration>
                        <from>
                            <image>adoptopenjdk:11-jre-hotspot</image>
                        </from>
                        <to>
                            <image>public/my-app</image>
                            <tags>
                                <tag>latest</tag>
                                <tag>${project.version}</tag>
                            </tags>
                        </to>
                        <container>
                            <entrypoint>
                                <shell>bash</shell>
                                <option>-c</option>
                                <arg>/entrypoint.sh</arg>
                            </entrypoint>
                            <ports>
                                <port>8080</port>
                            </ports>
                            <environment>
                                <SPRING_OUTPUT_ANSI_ENABLED>ALWAYS</SPRING_OUTPUT_ANSI_ENABLED>
                                <JHIPSTER_SLEEP>0</JHIPSTER_SLEEP>
                            </environment>
                            <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
                        </container>
                        <extraDirectories>
                            <paths>src/main/jib</paths>
                            <permissions>
                                <permission>
                                    <file>/entrypoint.sh</file>
                                    <mode>755</mode>
                                </permission>
                            </permissions>
                        </extraDirectories>
                    </configuration>
                </plugin>

一切正常,应用程序在启动时构建正确 ./mvnw package -Pprod -DskipTests jib:build -T16.0C。现在我将我的应用程序集成到 CI/CD Jenkins Pipeline 中,并且我正在创建一个类似于第一个但使用变量传递 Auth 数据的命令:

 ./mvnw -ntp -T2.0C jib:build -Djib.from.auth.username=myUserName -Djib.from.auth.password=mygitlabtoken01 -Dimage=registry.gitlab.com/myapp -X 

当我 运行 我得到:

[INFO] Using credentials from Docker config (/Users/myUser/.docker/config.json) for registry.gitlab.com/neoris-emea-internal/ianthe/ianthe-app/ianthe
[DEBUG] attempting bearer auth for registry.gitlab.com/app...
[INFO] The base image requires auth. Trying again for adoptopenjdk:11-jre-hotspot...
[INFO] Using credentials from <from><auth> for adoptopenjdk:11-jre-hotspot
[DEBUG] Trying basic auth for adoptopenjdk:11-jre-hotspot...
[DEBUG] configured basic auth for registry-1.docker.io/library/adoptopenjdk
[DEBUG] TIMED   Authenticating push to registry.gitlab.com : 1091.927 ms
[DEBUG] TIMED   Building and pushing image : 1122.522 ms
[ERROR] I/O error for image [registry-1.docker.io/library/adoptopenjdk]:
[ERROR]     javax.net.ssl.SSLHandshakeException
[ERROR]     Remote host terminated the handshake

我什么都不懂:

如果您仔细查看日志消息,Jib 确实使用了您通过 from.auth.username|passwordadoptopenjdk(托管在 Docker Hub 上)指定的凭据。

Using credentials from <from><auth> for adoptopenjdk:11-jre-hotspot

请注意以下行表示 Docker 配置用于 registry.gitlab.com(目标注册表)。

Using credentials from Docker config (/Users/myUser/.docker/config.json) for registry.gitlab.com/neoris-emea-internal/ianthe/ianthe-app/ianthe

关于SSLHandshakeException,它与任何Docker凭据无关。该错误来自更低的网络层(TLS 协议),因此该故障与 Jib 或 Jenkins 上 JVM 中的任何应用程序 运行 根本无关。它基本上是在告诉您 JVM 上的任何 Java 应用程序都无法与某些主机建立安全的 TLS 连接。有no simple answer or solution to a TLS handshake failure, so get some help from a network and TLS expert if possible. Also check out other SO questions like this one.