Skip to content

Specify http proxy settings with native java system properties #2158

Closed
@ghost

Description

When using new ApacheDockerHttpClient.Builder().build(), the ApacheDockerHttpClientImpl ctor is in turn called which builds an HttpClient using

httpClient = HttpClients.custom() .setRequestExecutor(new HijackingHttpRequestExecutor(null)) .setConnectionManager(connectionManager) .setDefaultRequestConfig(defaultRequest.build()) .disableConnectionState() .build();
(https://github.com/docker-java/docker-java/blob/main/docker-java-transport-httpclient5/src/main/java/com/github/dockerjava/httpclient5/ApacheDockerHttpClientImpl.java#L122)

Looking at the javadoc for HttpClients, https://hc.apache.org/httpcomponents-client-5.2.x/current/httpclient5/apidocs/ it says that it will use the native system properties for specifying proxy hosts only if useSystemProperties() is called before calling build().

If I'm following this correctly, the code above is calling build() without calling useSystemProperties() and therefore we are not able to specify a https proxy host using the system properties with ApacheDockerHttpClient.

Should that call be inserted just before .build() or was it intentionally left out? If it was left out on purpose, how would one specify an http proxy host when using ApacheDockerHttpClient?

To give context, I followed a rabbit hole from https://github.com/bmuschko/gradle-docker-plugin/blob/master/src/main/java/com/bmuschko/gradle/docker/internal/services/DockerClientService.java#L107 that lead me here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions