本地执行docker推送命令失败,不能上传镜像到harbor

Blade 未结 1 112
半路笙歌
半路笙歌 2024-09-24 12:11

一、该问题的重现步骤是什么?

1. 在项目对应的服务目录下执行命令

mvn clean package dockerfile:build dockerfile:push

2. 报错:[ERROR] Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

3.已经在终端登录了harbor。

docker login 

4.docker的配置

image.png

二、你期待的结果是什么?实际看到的又是什么?

可以正常上传镜像到harbor服务器

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

bladex

2.5.1

macos

四、请提供详细的错误堆栈信息,这很重要。

[INFO] Image will be built as 121.36.56.226:88/blade/ihp-dict:2.5.1.RELEASE

[INFO] 

[INFO] Step 1/11 : FROM adoptopenjdk/openjdk8-openj9:alpine-slim

[INFO] 

[ERROR] Get "https://registry-1.docker.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

[WARNING] An attempt failed, will retry 1 more times

org.apache.maven.plugin.MojoExecutionException: Could not build image

    at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:247)

    at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)

    at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)

    at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)

    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)

    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)

    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)

    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke (Method.java:498)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)

    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)

    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

Caused by: com.spotify.docker.client.exceptions.DockerException: Get "https://registry-1.docker.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

    at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError (LoggingProgressHandler.java:105)

    at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress (LoggingProgressHandler.java:63)

    at com.spotify.docker.client.DefaultDockerClient$BuildProgressHandler.progress (DefaultDockerClient.java:312)

    at com.spotify.docker.client.ProgressStream.tail (ProgressStream.java:77)

    at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2754)

    at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2738)

    at java.util.concurrent.FutureTask.run (FutureTask.java:266)

    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)

    at java.lang.Thread.run (Thread.java:748)

[INFO] dockerfile: null

[INFO] contextDirectory: /opt/project/zkml/newCodeup/backendJiuMei/blade-service/ihp-dict

[INFO] Building Docker context /opt/project/zkml/newCodeup/backendJiuMei/blade-service/ihp-dict

[INFO] Path(dockerfile): null

[INFO] Path(contextDirectory): /opt/project/zkml/newCodeup/backendJiuMei/blade-service/ihp-dict

[INFO] 

[INFO] Image will be built as 121.36.56.226:88/blade/ihp-dict:2.5.1.RELEASE

[INFO] 

[INFO] Step 1/11 : FROM adoptopenjdk/openjdk8-openj9:alpine-slim

[INFO] 

[ERROR] Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

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

[INFO] BUILD FAILURE

五、若有更多详细信息,请在下面提供。

image.png

1条回答
  •  半路笙歌
    2024-09-24 13:04

    搞定了,添加了华为的镜像加速器就可以了

    0 讨论(0)
提交回复