-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically propagate proxy environment variables to docker env #3834
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tstromberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Closing in preference to #3835 - which is admittedly a bit more advanced. |
Reopening, since this is a good introductory approach. |
It would be nice to have something more portable as, well ? i.e. those proxy variables are also needed for other runtimes |
if !cmd.Flags().Changed("docker-env") { | ||
for _, k := range proxyVars { | ||
if v := os.Getenv(k); v != "" { | ||
dockerEnv = append(dockerEnv, fmt.Sprintf("%s=%s", k, v)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, potentially user can have multiple dockerEnv variables set.
In case, users have NO_PROXY as well as "HTTPS_PROXY" set it shd error out right? or is this handled later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have something more portable as, well ?
Yes, I agree. This is an introductory PR that only solves the problem for most (99%?) of users who use the defaults. Other runtimes so far don't have a mechanism for introducing environment variables, but I suspect that #3835 should cover them nicely, which adds them to /etc/environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user manually sets --docker-env, this PR is disabled.
NO_PROXY and HTTPS_PROXY are complimentary, and thus plumbed into the environment as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool.
Currently, our documentation recommends that users use:
This makes the setting of --docker-env automatic if the environment variables are set, and partially resolves #3242