After the SB 3.1.6 -> 3.1.7 update we started to have an issue with docker-java library connecting to docker daemon:

org.apache.hc.client5.http.HttpHostConnectException: Connect to unix://localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused.

We haven't changed any configuration, we've been always using UNIX socket at /var/run/docker.sock.

Downgrading to 3.1.6 solved the issue.

Could also be due to an update of an external dependency.

More details: https://github.com/docker-java/docker-java/issues/2290

Comment From: wilkinsona

Spring Boot doesn't use docker-java or manage its version so it's not clear why you believe that this is a Spring Boot problem. Please provide the complete stack trace of the HttpHostConnectException and describe the steps that are required to reproduce it.

Comment From: azuenko

Hello Andy,

I'm duplicating the stack trace posted by @SeBBBe from the docker-java issue. Ours look similar, but much more noisy.

java.lang.RuntimeException: org.apache.hc.client5.http.HttpHostConnectException: Connect to unix://localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused

    at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:195)
    at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
    at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
    at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:202)
    at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:74)
    at com.github.dockerjava.core.exec.ListContainersCmdExec.execute(ListContainersCmdExec.java:44)
    at com.github.dockerjava.core.exec.ListContainersCmdExec.execute(ListContainersCmdExec.java:15)
    at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)

Neither SB uses docker-java, nor docker-java uses SB. However, both projects rely on org.apache.httpcomponents.client5. In the recent SB release the http client lib has been bumped 5.2.1 -> 5.2.3 . This might be the reason why docker-java started to fail.

You may close the issue, SB is not impacted. It's still good to have it here for the reference.

Comment From: wilkinsona

This might be the reason why docker-java started to fail

That sounds likely. You could confirm by downgrading to 5.2.1 and seeing if the problem is resolved.

I'll close this one as I don't think there's anything we could or should do in Spring Boot.

Comment From: SeBBBe

Hi! I can confirm that adding the following to the pom.xml resolves the issue:

    <dependencyManagement>
        <dependencies>
        ...
            <dependency>
                <groupId>org.apache.httpcomponents.client5</groupId>
                <artifactId>httpclient5</artifactId>
                <version>5.2.1</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

Comment From: wilkinsona

That's useful info, @SeBBBe. Thank you.