错误详细如下:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project testt: Exception caught: pull access denied for jdk1.8, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
-> [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


核心一句是这个

Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project testt: Exception caught: pull access denied for jdk1.8, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

百度查了一下,很多人说是要登录,实际上不是要登录,也不是仓库不存在,实际上是我的docker上没有jdk1.8的镜像文件,需要自己下一个,我是自己把jdk-8u221-linux-x64.tar.gz 通过DockerFile上传到上面去的,详情可以看https://blog.csdn.net/u014204541/article/details/102617063
dockerfile那块怎么传一个jdk文件进去,当然可以自己search jdk下载

解决jdk后,再执行构建就可以成功了

D:\idea_workspace\yun6\testt>mvn docker:build
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testt 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- docker-maven-plugin:0.4.13:build (default-cli) @ testt ---
[INFO] Copying D:\idea_workspace\yun6\testt\target\app.jar -> D:\idea_workspace\yun6\testt\target\docker\app.jar
[INFO] Building image 122.51.6.249:5000/testt:1.0-SNAPSHOT
Step 1/3 : FROM jdk1.8

 ---> da5cff387e3f
Step 2/3 : ADD /app.jar //

 ---> e140582eaf41
Step 3/3 : ENTRYPOINT ["java",?"-jar","/app.jar"]

 ---> Running in b415e824f0db
Removing intermediate container b415e824f0db
 ---> f2cd873d2809
ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}
Successfully built f2cd873d2809
Successfully tagged 122.51.6.249:5000/testt:1.0-SNAPSHOT
[INFO] Built 122.51.6.249:5000/testt:1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:16 min
[INFO] Finished at: 2019-10-18T16:47:55+08:00
[INFO] Final Memory: 29M/264M
[INFO] ------------------------------------------------------------------------

D:\idea_workspace\yun6\testt>

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐