If the docker daemon isn't running locally, we get the following exception at the moment:
[INFO] --- spring-boot-maven-plugin:2.3.0.BUILD-SNAPSHOT:build-image (build-image) @ demo-image ---
[INFO] Building image 'docker.io/snicoll78/demo-image:latest'
[INFO]
[INFO] I/O exception (java.io.IOException) caught when processing request to {}->docker://localhost:2376: com.sun.jna.LastErrorException: [61] Connection refused
[INFO] Retrying request to {}->docker://localhost:2376
[INFO] I/O exception (java.io.IOException) caught when processing request to {}->docker://localhost:2376: com.sun.jna.LastErrorException: [61] Connection refused
[INFO] Retrying request to {}->docker://localhost:2376
[INFO] I/O exception (java.io.IOException) caught when processing request to {}->docker://localhost:2376: com.sun.jna.LastErrorException: [61] Connection refused
[INFO] Retrying request to {}->docker://localhost:2376
[INFO] > Pulling builder image 'docker.io/cloudfoundry/cnb:0.0.53-bionic' 100%
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.379 s
[INFO] Finished at: 2020-02-13T08:41:28+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.0.BUILD-SNAPSHOT:build-image (build-image) on project demo-image: com.sun.jna.LastErrorException: [61] 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
We should consider improve that with a more dedicated error message.
Comment From: scottfrederick
@mikesmithson This might be a good issue for contribution.
All the connectivity to Docker from the Gradle and Maven plugins should be going through one class. There's some error handling in there, but it's apparently not catching this case.
Comment From: mikesmithson
@scottfrederick - OK, I assume that you don't want a DockerException thrown here. I would assume that you would want the errors captured to be set back into the reasonPhrase and then return the response. If that is the reasonable approach, I can submit a PR right now.
Comment From: scottfrederick
Throwing a DockerException
might be OK, as it extends RuntimeException
and provides a good message that includes the URI that we were attempting to hit. Translating the IOException
that the method currently throws to a DockerException
should allow the condition to bubble up to the plugins. You wouldn't have all the fields that exception expects currently when the code gets a response with a status code, but you could modify it to provide as much info as possible in that scenario.