-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix proxy-configuration being ignored on docker create #1573
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
Conversation
|
ping @dave-tucker PTAL 😅 |
Codecov Report
@@ Coverage Diff @@
## master #1573 +/- ##
==========================================
+ Coverage 55.16% 55.16% +<.01%
==========================================
Files 301 301
Lines 20384 20392 +8
==========================================
+ Hits 11244 11249 +5
- Misses 8335 8336 +1
- Partials 805 807 +2 |
Proxies configured in config.json were only taking effect
when using `docker run`, but were being ignored when
using `docker create`.
Before this change:
echo '{"proxies":{"default":{"httpProxy":"httpProxy","httpsProxy":"httpsProxy","noProxy":"noProxy","ftpProxy":"ftpProxy"}}}' > config.json
docker inspect --format '{{.Config.Env}}' $(docker --config=./ create busybox)
[PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
With this change applied:
echo '{"proxies":{"default":{"httpProxy":"httpProxy","httpsProxy":"httpsProxy","noProxy":"noProxy","ftpProxy":"ftpProxy"}}}' > config.json
docker inspect --format '{{.Config.Env}}' $(docker --config=./ create busybox)
[NO_PROXY=noProxy no_proxy=noProxy FTP_PROXY=ftpProxy ftp_proxy=ftpProxy HTTP_PROXY=httpProxy http_proxy=httpProxy HTTPS_PROXY=httpsProxy https_proxy=httpsProxy PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
Reported-by: Silvano Cirujano Cuesta <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
cc6a92c to
91bc4dd
Compare
|
ping @silvin-lubecki @vdemeester PTAL |
dave-tucker
left a comment
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.
LGTM
|
ping @silvin-lubecki @vdemeester PTAL 🙏 |
vdemeester
left a comment
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.
LGTM 🐯
| func runCreate(dockerCli command.Cli, flags *pflag.FlagSet, opts *createOptions, copts *containerOptions) error { | ||
| func runCreate(dockerCli command.Cli, flags *pflag.FlagSet, options *createOptions, copts *containerOptions) error { | ||
| proxyConfig := dockerCli.ConfigFile().ParseProxyConfig(dockerCli.Client().DaemonHost(), copts.env.GetAll()) | ||
| newEnv := []string{} |
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.
nit: var newEnv []string
silvin-lubecki
left a comment
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.
As this proxy configuration is now handled by runCreate, shouldn't we remove the exact same code from runRun ? Or if not, at least factorize the common code between the two commands?
Ideally, we would be able to share more code; the reason I did not do this (and instead went for some small amount of duplication), is that I wanted to keep the code changes minimal (in case we wanted to backport), and didn't want to put the cli-configuration handling too deep into the stack;
In the above, possibly |
|
That makes sense, thank you @thaJeztah 👍 |
silvin-lubecki
left a comment
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.
LGTM
relates to: #93
fixes docker/for-linux#369
Proxies configured in config.json were only taking effect when using
docker run, but were being ignored when usingdocker create.Before this change:
With this change applied:
Reported-by: Silvano Cirujano Cuesta [email protected]
Signed-off-by: Sebastiaan van Stijn [email protected]
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)