Maven build docker image fails, [ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.9:build

1 points
Asked by:

I try to build docker image with maven, CLI:

mvn clean install

I get this error:

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.9:build
(default) on project az-data-processor:
Could not build image: java.util.concurrent.ExecutionException:
Connect to localhost:2375 [localhost/, localhost/0:0:0:0:0:0:0:1]
failed: Connection refused: connect -> [Help 1]

How can I fix it?

Thanks in advance.

1 answer
4 points
Answered by:

Make sure, your docker run default daemon on tcp://localhost:2375

Expose daemon on tcp://localhost:2375 without TLS

Exposing daemon on TCP without TLS helps legacy clients connect to the daemon. 
It also makes yourself vulnerable to remote code execution attacks. 
Use with caution.

Steps with fix:

  1. Go to docker settings (Second mouse click on docker icon, click settings)
  2. Click on checkbox 'Expose daemon on tcp://localhost:2375 without TLS'
  3. Apply & Restart
  4. Run again: mvn clean install

Solution to your problem:

After that you should see:

[INFO] Successfully built your_project_name
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------


0 comments Add comment
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂