使用dockerfile-maven-plugin推送harbor失败,手工docker推送成功。

Blade 已结 1 759
78780638
78780638 剑圣 2022-03-14 13:46

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

1. mvn clean package dockerfile:build dockerfile:push失败 ,报错denied: requested access to the resource is denied

2. 

3.


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

使用mvn clean package dockerfile:build dockerfile:push 插件可成功推送到harbor


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

bladeX 2.9.0

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

[INFO] --- dockerfile-maven-plugin:1.4.13:push (default-cli) @ blade-user ---

[WARNING] Did not find maven server configuration for docker server 10.0.2.222:8080

[INFO] The push refers to repository [xxx.xxx.xxx.xxx:8080/cptg/blade-user]

[INFO] Image 97a8e01c310b: Preparing

[INFO] Image b5105822f498: Preparing

[INFO] Image 022e61f1a07d: Preparing

[INFO] Image 91fef57e43c2: Preparing

[INFO] Image 86c7f9599ba1: Preparing

[INFO] Image d148a6d68ba3: Preparing

[INFO] Image 50644c29ef5a: Preparing

[INFO] Image d148a6d68ba3: Waiting

[INFO] Image 50644c29ef5a: Waiting

[ERROR] denied: requested access to the resource is denied

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

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

    at com.spotify.plugin.dockerfile.PushMojo.execute (PushMojo.java:90)

    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:289)

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

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

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

    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)

Caused by: com.spotify.docker.client.exceptions.DockerException: denied: requested access to the resource is denied

    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.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)

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

1条回答
  •  admin
    admin (最佳回答者)
    2022-03-15 00:22

    他的报错信息为

    denied: requested access to the resource is denied
    
    Did not find maven server configuration for docker server 10.0.2.222:8080


    从报错来看,就是无法连上服务。需要查看一下对应的maven配置,看下docker的地址、端口是否正确。

    作者追问:2022-03-15 00:22

    maven配置没有错,想了解清楚,打包推送是指直接在开发环境配置maven然后推送到服务器的Harbor吗?

    我开发环境直接docker login是可以连接上去的。Harbor在服务器上部署了。开发环境maven是需要配置Harbor的network IP地址?

    回答: 2022-03-15 00:22

    开发环境需要配置harbor地址的,具体可以看下文档

    image.png

    0 讨论(1)
提交回复