问题:
com.spotify.docker.client.exceptions.DockerException: pull access denied for alpine-java, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
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: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: pull access denied for alpine-java, repository does not exist or may require 'docker login': 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.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)
解决:
-
登录 Harbor :确保你已经使用
docker login
命令登录到 Harbor 。如果你还没有 Harbor 账户,你需要先注册一个。 -
检查镜像名称:确认
alpine-java
镜像名称是否正确,并且该镜像存在于 Docker Hub 上。如果名称错误或镜像不存在,你需要使用正确的镜像名称或查找是否存在替代的镜像。 -
检查 Docker 配置:如果你的网络环境需要通过代理访问外部资源,确保 Docker 配置正确地设置了代理。
-
检查网络连接:确保你的网络连接稳定,并且可以访问 Harbor 。
-
检查 Harbor 状态:访问Harbor 状态页面
来查看是否有已知的服务中断或维护。 -
使用国内镜像源:如果你在中国大陆或网络连接不稳定的地区,配置 Docker 使用镜像加速器可以提高下载速度并减少超时的可能性。
-
检查 Docker 守护进程日志:查看 Docker 守护进程的日志,可能会提供更多关于错误的详细信息。
-
升级 Docker 和客户端:确保你使用的是最新版本的 Docker 和 Docker 客户端,因为旧版本可能存在已知的 bug 或性能问题。
-
检查权限:如果你尝试访问的是私有仓库或私有镜像,确保你有足够的权限。
-
使用正确的 Harbor URL:如果你使用的是私有仓库或第三方仓库,确保在拉取镜像时使用了正确的 URL。
我的问题:
修改配置pom.xml的repository、username、password配置。