build: make proxy build-arg override check case-insensitive#3697
build: make proxy build-arg override check case-insensitive#3697crazy-max merged 1 commit intodocker:masterfrom
Conversation
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
| name: "case insensitive match", | ||
| proxyArgs: map[string]string{"no_proxy": "cli"}, |
There was a problem hiding this comment.
I know in the CLI and daemon we only consider NO_PROXY and no_proxy, but don't consider nO_pRoXy; perhaps worth considering.
(I can dig up a link to the code if needed)
There was a problem hiding this comment.
e.g.;
Also possibly relevant; if either HTTP_PROXY or http_proxy is set, we set both (because upper/lowercase depends on implementation, and there's no official standard)
https://github.com/moby/moby/blob/83bca512aa7ffc1bb4f37ce1107e0d3e3489ad43/daemon/command/daemon.go#L1119-L1132
func configureProxyEnv(ctx context.Context, cfg config.Proxies) {
if p := cfg.HTTPProxy; p != "" {
overrideProxyEnv(ctx, "HTTP_PROXY", p)
overrideProxyEnv(ctx, "http_proxy", p)
}
if p := cfg.HTTPSProxy; p != "" {
overrideProxyEnv(ctx, "HTTPS_PROXY", p)
overrideProxyEnv(ctx, "https_proxy", p)
}
if p := cfg.NoProxy; p != "" {
overrideProxyEnv(ctx, "NO_PROXY", p)
overrideProxyEnv(ctx, "no_proxy", p)
}
}|
I guess we should also fix it in |
Opened moby/buildkit#6560 |
fixes #3636
Buildx currently checks whether a proxy default should be injected using a case-sensitive map lookup, so
--build-arg no_proxy=...does not block injectingNO_PROXYfrom~/.docker/config.json.That can result in both
build-arg:no_proxyandbuild-arg:NO_PROXYbeing sent to BuildKit and because BuildKit resolves proxy args case-insensitively from a Go map, the winning value can vary by map iteration order.With this patch, Buildx uses a case-insensitive key existence check before injecting proxy defaults, so an explicit CLI proxy arg consistently takes precedence. This aligns behavior with user expectation that explicit
--build-argvalues should deterministically override config defaults.