client: Allow Proxy Configuration in config.json#30588
client: Allow Proxy Configuration in config.json#30588dave-tucker wants to merge 1 commit intomoby:masterfrom
Conversation
|
Note: This will fail CI as the |
a693c7a to
43f3b63
Compare
|
I'd like to test this on our network connection config @ ADP. It's just what I was after. @dave-tucker |
|
I can't build this behind a proxy without hacking all the Docker build scripts :-( i.e. |
|
@alexellis let me see if I can get this passing CI so you can download a bundle from CI to test with |
|
@dave-tucker I hacked the Makefile so that it passed --build args into the I edited a local config.json file, but it's not working for me (might be a user error) Here's what I have: |
|
Also tried editing
|
|
I see bugs 🐛 Working on a fix @alexellis will ping you when it's ready for testing. |
bb34d69 to
f75c2e0
Compare
cli/command/image/build.go
Outdated
There was a problem hiding this comment.
Perhaps some Golang expert can help here as I'm out of my depth.
If instead of o.Set I initially tried m[k] = &v, however the value of m[k] outside of this function was always "".
This makes no sense to me as when I try to reproduce in the Go Playground I can't.
There is probably some subtle interaction happening here that I don't quite understand.
I'd like to fix this before merge so I can avoid calling ConvertKVStringsToMapWithNil twice.
There was a problem hiding this comment.
yeah, taking address from range variable doesn't work.
|
Ok @alexellis it's ready for testing. A couple more pointers:
|
96d19f1 to
e37c03c
Compare
|
@dave-tucker This would be really helpful in my case since I need to specify those build-args all the time. I have two suggestions though:
Wouldn't this be a typical use case? Maybe you can also add something like "systemProxy": bool to the config file?
|
|
@danielpanteleit Thanks for the feedback
|
|
Hey Dave, is this ready for testing yet? Do you need any help with the coding? |
|
@alexellis ready for testing and passing CI. |
|
Planning to try it out again this week. I'll test with this on DfM? Should also work on Linux client? |
|
@alexellis yes it should work on any client - either on OSX or Linux |
|
Showing client and server installed on DfM @dave-tucker : With minimal Dockerfile this is working: Internet reachable:
Unreachable:
Looks good on DfM 👍
|
|
@dave-tucker I could really do with this soon.. we're running some workshops with Docker and the instructions are getting way more complicated with having to detail What is the process for moving the change forward - does it need buy-in from more maintainers? |
|
re: next steps, where are we at @thaJeztah? |
|
Yes, specifically for puling images from remote registries such as the Hub. I originally thought that was what the |
From a user experience point of view - at ADP all daemons needing internet access will have to go through a proxy, so a default option (now or in a later PR) would be a plus. |
Definitely agree with this point. |
|
Thanks @thaJeztah. In that case what I'll do is as follows: I'll work on 3 PR's:
@alexellis your other use case is a tricky one 🤡 Implementation-wise... I see two options:
TL;DR is that It's possible, but definitely a lot of work (read: I'd prefer to focus on my other PR's but if someone else wants to take a stab at it, great!) My question is, is it worth the effort? We'd be deviating from a fairly standard practice (configuration of proxy via environment variables) which many people are already managing with Chef, Puppet, Salt, Ansible etc.. |
cli/config/configfile/file.go
Outdated
There was a problem hiding this comment.
This could be misleading. Someone could look at these and think they're for all client connections and not just for use in the build as build-args. Could we prefix these with BuildArg, or something, to make this clear?
There was a problem hiding this comment.
I've changed this (patch set coming soon) to:
{
"proxies":
{
"default":
{
"httpProxy" : "http://proxy.example.com"
}
}
}
These will now be used for both docker build and docker run.
The top-level key can be easily changed to reflect this.
@alexellis suggested containerProxies but I'm undecided as yet
cli/command/image/build.go
Outdated
There was a problem hiding this comment.
To set both upper and lowercase derivatives (e.g HTTP_PROXY and http_proxy) as some applications will only check for one.
There was a problem hiding this comment.
interesting, didn't notice before that we actually list both variants in the code.
There was a problem hiding this comment.
Yes, there's no official spec for those; some software uses lowercase other use uppercase 😞
cli/config/configfile/file.go
Outdated
There was a problem hiding this comment.
Should the json keys be all uppercase to match what people would have to type on the --build-arg option? Since case does matter (at least in some envs) I think using the right variant would reduce potential confusion and typos.
There was a problem hiding this comment.
I'm not sure what the convention is here. Personally I'd prefer http-proxy, https-proxy etc.. but from what I saw in the code it seems that camelCase is the done thing. Happy to change to whatever.
There was a problem hiding this comment.
yea, I tend to view this less of a go or json convention and more one of consistency with how they would specify things elsewhere. For example, --build-arg http_PROXY=... should probably not be the same a --build-arg HTTP_PROXY=... since those really are two different env vars. So we should treat them as different in the config file too (assuming go allows us to - it might try to be "helpful" here and treat them the same :-( ). But we should document/code it the right way.
There was a problem hiding this comment.
it would be really nice if the build args were nested under a "BuildArgs" property - then we wouldn't need to prefix them. But I'm not sure if our config file supports nested things.
|
ok! updated based on #30588 (comment) This PR not only adds the config to |
This commit modifies config.json to allow for any proxies allowed in build-args to be configured. These values will then be used by default as build-args in docker build. Signed-off-by: Dave Tucker <[email protected]>
3dc49c2 to
647ab3e
Compare
|
Rebased but not able to get green tests locally. Seeing if I get the same result in CI... Locally I get lots of errors like this: It's the |
|
@dave-tucker what's the status on this one; are you still working on this? Should we close in the meantime? |
|
I don't think I'm going to get time to fix this before Dockercon so feel free to close for now... |
|
I think everyone is quite busy, so let me close this for now. But we definitely want this so, please remind us to reopen once you have some bandwidth again |
|
Hmm this is the most useful PR for proxies and it's just been closed. Is the design review and implementation complete? What needs to be done to "finish it"? |
|
@alexellis AFAIK the design was "ok" as it follows the guidelines set out in #30588 (comment) All that needs doing here is to troubleshoot and fix the integration test failures. |
|
@thaJeztah can you (or someone else with permission) re-open this PR? |
|
Yay! thanks Dave
…On 21 Apr 2017 07:49, "Dave Tucker" ***@***.***> wrote:
@thaJeztah <https://github.com/thaJeztah> can you (or someone else with
permission) re-open this PR?
The failing tests should be fixed in #32763
<#32763>
Once merged, I'll happily rebase to pick this up..
I've cherry-picked my other PR and run integration tests and they all pass
🎉
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#30588 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGEGz5AtRxLuYYFPXdBsDy5ltI0NHCrJks5ryKXvgaJpZM4Lyj-M>
.
|
|
Ugh, sorry didn't see your ping. GitHub doesn't allow me to reopen, possibly due to the repo-move (or did you push to the branch after it was closed?) |
- What I did
Added a mechanism to allow HTTP/HTTPS/FTP/NO proxy variables to be configured in
config.json. These are then automatically populated in adocker runcommand as environment variables or asbuild-argsindocker build!This makes it easier for users suffering behind an HTTP Proxy as they only need to configure this once as opposed to creating custom aliases or forgetting the args and being denied buildage/runnage.
Updates #30323
- How I did it
Extended the
configfilewith some new proxy related variables.These are scoped per Docker Host with a
defaultcatchall.The config file is then read by the
buildorruncommand and the necessary variables are exported.A
-eflag or--build-argprovided on the CLI will override these default settings.- How to verify it
There are integration tests! But manually, you may:
config.jsonwith{ "proxies" : { "httpProxy" : "http://127.0.0.1:3001" }docker --config /path/to/config build -t configtest .HTTP_PROXYvariable is as configureddocker run --rm configtest env- Description for the changelog
Added HTTP/HTTPS/FTP proxy configuration to
config.json- A picture of a cute animal (not mandatory but encouraged)