Spotify docker-maven-plugin can't connect to localhost:2375

Expected behavior

I would like to have the maven plugin to be able to do it’s job. It might be a problem with the plugin implementation, (and I have filed a bug). I think some tools depends on DOCKER_HOST to be set

Actual behavior

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.5:build (server) on project web-service: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1, localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused → [Help 1]

Could it be that port 2375 needs to be forwarded to localhost?

Information

OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.0-beta6
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160414-075248.tar.gz.
Your unique id in bugsnag is: 057F3766-D887-471F-A57F-8D352F2B2857
Please quote this in all correspondence.

Steps to reproduce the behavior

  1. Build a project with maven using the Spotify Docker plugin
    Maven version 3.2.3
    Plugin version 0.4.5

Hello

I had the same issue, you just need to
export DOCKET_HOST=unix:///private/var/tmp/docker.sock

and it then work

Hope it helps

1 Like

Yes, the plugin should default to the default local socket if DOCKER_HOST is not set - this is an upstream bug.

1 Like

minor typo on the variable name. The correct one is:

export DOCKER_HOST=unix:///private/var/tmp/docker.sock

I am running into the same problem, but when I set the DOCKER_HOST then I am unable to connect to the docker daemon.

It turned out that I was using an older version of the Spotify plugin and I have upgraded to version 0.4.9 and used the following to get it to work:

DOCKER_HOST=unix:///var/run/docker.sock mvn clean install

1 Like

Looks like this is no more required with spotify plugin 0.4.13. I recently switch from docker toolbox to docker for mac and I was running a very old version of spotify plugin. Upgrading to 0.4.13 was enough to solve the issue, no need to define DOCKER_HOST variable.

I am facing same issue in WIndows, how to set DOCKER_HOST?
IS this a env variable

1 Like

@jinnabalu
Which version of spotify plugin are you using? Upgrade to 0.4.13 if you are using older version. For me upgrading to this version was enough to solve the issue.

I also have the same problem , i use
Windows 10 and Docker for Windows and no Machines.
When i build from maven i included the spotify plugin version 0.4.13 But still it is not resolved

Connect to localhost:2375
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build
Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect

I went into settings for docker and turned on “Expose daemon to tcp://localhost:2375 without TLS” and it started working.

5 Likes

This also worked for me: “Expose daemon to tcp://localhost:2375 without TLS”

1 Like

export DOCKET_HOST=unix:///private/var/tmp/docker.sock which file should it be set

I ran into same issue in windows 10 env. I went to: “Expose daemon to tcp://localhost:2375 without TLS”; switched it off and back on couple of time and the error went away.

1 Like

Go to your notification tab, right click the Whale Icon and then click Settings.
In the first page in the very end you will have “Expose daemon tcp://localhost:2375 without TLS” check this box

3 Likes

Thanks gowrav27, this saved my bacon. This also works on the new replacement plugin named “dockerfile-maven-plugin”, same problem and solution.

Hi Gowrav,

Please can you advise, how to do it through docker
tools for windows?

Thanks
Devd

I Havent used the docker tool, I have to play around in it, let me know if this helps Are you trying to connect to a TLS-enabled daemon without TLS?
If not reply back, I will see what I can do

Thanks, it works for me! :slight_smile:

I’m having the same issue, on Docker Community Edition Version 17.12.0-ce-mac55 (23011).

I want to use @gowrav27 's solution, but when I right click the whale icon in the top menu bar, I see “Preferences” not “Settings”. In “Preferences” I don’t see “Expose daemon tcp://localhost:2375 without TLS”.

Any suggestions/?