Skip to content

c8d/resolver: Use per-host HTTP client for auth requests#52600

Merged
thaJeztah merged 1 commit into
moby:masterfrom
vvoland:c8d-fix-registries-http
May 13, 2026
Merged

c8d/resolver: Use per-host HTTP client for auth requests#52600
thaJeztah merged 1 commit into
moby:masterfrom
vvoland:c8d-fix-registries-http

Conversation

@vvoland
Copy link
Copy Markdown
Contributor

@vvoland vvoland commented May 11, 2026

When using the containerd image store, each registry host entry carries its own HTTP client configured with the host-specific TLS settings (custom CAs from /etc/docker/certs.d, insecure-registries, etc.).

hostsWrapper replaces the Authorizer on every host entry so that explicit auth credentials are used for token/OAuth requests. Previously it created a single authorizer before iterating the hosts, without supplying any HTTP client.

The result was that token endpoint requests bypassed custom CAs and insecure-registry settings.

containerd integration: Fix auth token requests ignoring per-host TLS settings (custom CAs, insecure-registries).

When using the containerd image store, each registry host entry carries
its own HTTP client configured with the host-specific TLS settings
(custom CAs from /etc/docker/certs.d, insecure-registries, etc.).

hostsWrapper replaces the Authorizer on every host entry so that explicit
auth credentials are used for token/OAuth requests.
Previously it created a single authorizer before iterating the hosts,
without supplying any HTTP client.

The result was that token endpoint requests bypassed custom CAs and
insecure-registry settings.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland self-assigned this May 11, 2026
@github-actions github-actions Bot added area/daemon Core Engine containerd-integration Issues and PRs related to containerd integration labels May 11, 2026
@vvoland vvoland added this to the 29.5.0 milestone May 11, 2026
@thaJeztah thaJeztah requested a review from Copilot May 13, 2026 11:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes containerd image-store registry authentication so that token/OAuth requests use the per-registry-host HTTP client (and therefore respect host-specific TLS settings such as custom CAs under /etc/docker/certs.d and insecure-registries). This addresses reported failures where docker login succeeds but docker push/pull fails during token retrieval due to TLS verification errors.

Changes:

  • Update hostsWrapper to build a docker.Authorizer per registry host entry using that host’s configured *http.Client.
  • Extend authorizerFromAuthConfig to accept an HTTP client and pass it to containerd’s authorizer via docker.WithAuthClient(...).

Comment on lines 41 to 49
return func(n string) ([]docker.RegistryHost, error) {
hosts, err := hostsFn(n)
if err != nil {
return nil, err
}

for i := range hosts {
hosts[i].Authorizer = authorizer
hosts[i].Authorizer = authorizerFromAuthConfig(*optAuthConfig, ref, hosts[i].Client)
}
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit 57e3b11 into moby:master May 13, 2026
344 of 359 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine containerd-integration Issues and PRs related to containerd integration impact/changelog kind/bugfix PR's that fix bugs

Projects

None yet

3 participants