Docker Community Forums

Share and learn in the Docker community.

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

(Thomas Rambrant) #1

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: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/, 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?


OS X: version 10.11.4 (build: 15E65) 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

(Lionel Touati) #2


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

(Justin Cormack) #3

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

(Jorge Luis Middleton) #4

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

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

(David Witherspoon) #5

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

(David Witherspoon) #6

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

(Tahirakhtar) #7

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.

(Jinna Balu) #8

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

(Tahirakhtar) #9

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.

(Manisap) #10

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: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect

(Johninjax) #12

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

(Ericis) #13

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

(Liuqinfu) #14

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

(Markmnei) #15

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.

(Gowrav27) #16

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

(Kennyk65) #17

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

(Devgawade) #18

Hi Gowrav,

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


(Gowrav27) #19

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

(Lombocska) #20

Thanks, it works for me! :slight_smile:

(Codycoggins) #21

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/?