Description
Hi Docker-Java-Devs,
I hope you're doing well.
I wanted to bring to your attention an issue I've encountered with the ApacheDockerHttpClient when connecting to Docker via a Unix socket (unix://). Specifically, when the client detects a unix:// connection, it automatically changes the host to localhost:2375. This behavior causes issues when the Docker host is intended to be a Unix socket, and not TCP.
This seems to be problematic both on Linux and Windows environments, as it tries to connect to the wrong endpoint (localhost), resulting in the following error:
HttpHostConnectException: Connect to unix://localhost:2375 failed: Connection refused
Interestingly, this issue does not occur when using the OkHttpDockerHttpClient. The OkHttp client correctly handles the unix:// scheme without trying to alter the connection to localhost, which resolves the issue.
It would be great if we could review and potentially update the handling of unix:// connections in ApacheDockerHttpClient to prevent this automatic conversion to localhost.
Let me know if you need any further details or assistance on this.
Best regards,
Luis Miguel Vasquez
Java Developer