Languages

Docker + Linux - Maven failed to build the project, spotify docker ProcessingException: java.io.IOException: No such file or directory

3 points
Asked by:
AnnLen
1873

I try to build my maven project, but got an error.

mvn cmd I use to build:

mvn clean install -Dmaven.test.skip=true

Docker version on my linux (CentOS distribution):

[root@localhost]# docker -v
Docker version 19.03.13, build 4484c46d9d

Error short:

java.util.concurrent.ExecutionException:
com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException:
java.io.IOException: No such file or directory -> [Help 1]

Error from maven:

[root@localhost]# mvn clean install -Dmaven.test.skip=true

.......

INFO: I/O exception (java.io.IOException) caught when processing request to
{}->unix://localhost:80: No such file or directory
Sep 29, 2020 3:57:27 AM
com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
        at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:208)
        at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:110)

.......

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.320s
[INFO] Finished at: Tue Sep 29 03:57:28 EDT 2020
[INFO] Final Memory: 47M/603M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.9:build
(default) on project data-mock-gen: Could not build image:
java.util.concurrent.ExecutionException:
com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException:
java.io.IOException: No such file or directory -> [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

How to fix it?

1 answers
6 points
Answered by:
AnnLen
1873

Fix:

[root@localhost]# export DOCKER_HOST=unix:///var/run/docker.sock

Restart docker:

[root@localhost]# service docker restart
Redirecting to /bin/systemctl restart docker.service

Run mvn:

[root@localhost]# mvn clean install -Dmaven.test.skip=true

.....

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.117s
[INFO] Finished at: Tue Sep 29 04:06:44 EDT 2020
[INFO] Final Memory: 50M/633M
[INFO] ------------------------------------------------------------------------

 

0 comments Add comment
Hey 👋
Would you like to know what we do?
  • Dirask is online IT community for professionals and hobbyist to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.