Basic http proxy configuration support by marcuslinke · Pull Request #386 · docker-java/docker-java

@marcuslinke

Fix issue #384. Respects the following system variables and their https counterparts:

http.proxyHost
http.proxyPort
http.nonProxyHosts
http.proxyUser
http.proxyPassword

@KostyaSha

Not sure but seems there is no other way to set Proxy? Is it possible to make additional withProxy() for client Builder? Use case: in jenkins Proxy configuratin is handled from UI and contains in jenkins objects, so plugins must pick jenkins proxy for connections.

@marcuslinke

@KostyaSha I think this could be implemented in a separate PR later. Need to evaluate proxy support for future netty engine first to define a common API. This is just 'basic' support of http proxies variables.

@KostyaSha

Imho, better stop doing 2.x support, minimise 3.x work and release 3.x sooner. WDYT?

@marcuslinke

@KostyaSha OK, I agree. Lets merge this to 2.x so basic proxy support will do it in v2.1.3 which i will release then. What should be included in v3.0.0? I think we should provide basic v1.21 API version compatibility at least. Existing tests should run against it succesfully.

marcuslinke added a commit that referenced this pull request

Dec 8, 2015
Basic http proxy configuration support

@garthy

This breaks if you pass unix:///var/run/docker.sock and have the proxies set. Could you check for uri type unix and not use a proxy in this case as it makes no sense?

@KostyaSha

IMHO should throw exception. Plus proxy support need to be refactored.

@garthy

I'm confused as to why should it trow an exception? You saying that if http_proxy is set you cannot use this library to connect to docker via unix:///var/run/docker.sock?

@KostyaSha

Depends on code place, for env resolution may be optional, for explicit programmatic configuration (in java code i set proxy for unix url) imho should throw. But afair nobody implemented ability to set Proxy directly for client. So my comment mostly about APIs that i would like to see finally.

@garthy

OK sorry I wasn't clear.

I agree if proxies are programaticly set and the docker protocol is unix:// then the API should throw an exception.

I was talking about global environment which should be ignored if not appropriate. Currently 2.1.3 thows an exception if the endpoint is unix:// as it tries to resolve the proxys no matter what hte endpoint protocol is It should skip the proxy code in all cases if then the protocol of the docker endpoint is unix://

@orzeh orzeh mentioned this pull request

Sep 14, 2017