Reputation: 4426
I installed the Docker executable with brew install docker
and I can see it in the PATH
of bash
:
$ which docker
/usr/local/bin/docker
I set up a Spring Boot application with this Dockerfile
:
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"]
When I have the Docker GUI application running, Maven builds the app and I can run it and see it locally. But when the Docker GUI application is not running, Maven is unable to build the app, even though it is in the bash executable, because it can't establish a connection to 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
Does Maven use a different PATH
than bash
? How can I give the path to the docker executable to Maven?
Upvotes: 0
Views: 337
Reputation: 159761
Docker uses a client-server architecture, and the "whale" application provides the "server" half of it. On a Mac you need to have the desktop application running (or a heavier-weight VM like what Docker Machine or minikube
provides) to use any Docker commands or otherwise interact with Docker.
Upvotes: 1