Maven构建与Docker GUI一起运行但不与二进制文件一起运行

问题描述 投票:0回答:1

我用brew install docker安装了Docker可执行文件,我可以在PATHbash中看到它:

$ which docker
/usr/local/bin/docker

我用这个Dockerfile设置了一个Spring Boot应用程序:

FROM openjdk:8-jre
MAINTAINER ...

COPY dist /dist/
ARG JAR_FILE
COPY target/${JAR_FILE} /target/app.jar
EXPOSE 8080
CMD ["java", "-jar", "/target/app.jar"]

当我运行Docker GUI应用程序时,Maven构建应用程序,我可以运行它并在本地查看它。但是当Docker GUI应用程序没有运行时,Maven无法构建应用程序,即使它位于bash可执行文件中,因为它无法建立与Docker的连接:

$ mvn clean install
[INFO] Scanning for projects...
...
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
...
Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused
...
Caused by: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused
...
Caused by: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused
...
Caused by: java.io.IOException: Connection refused
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.498 s
[INFO] Finished at: 2018-09-12T11:39:34+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.4:build (default) on project econometer: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused -> [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

Maven是否使用与PATH不同的bash?如何将docker可执行文件的路径提供给Maven?

maven docker
1个回答
0
投票

Docker使用客户端 - 服务器架构,“whale”应用程序提供“服务器”一半。在Mac上,您需要运行桌面应用程序(或者像Docker Machine或minikube提供的更重的VM)才能使用任何Docker命令或以其他方式与Docker交互。

© www.soinside.com 2019 - 2024. All rights reserved.