Skip to content

fix: route OCI artifact pulls through Docker Desktop HTTP proxy#13770

Open
glours wants to merge 1 commit intomainfrom
fix/oci-resolver-dd-proxy
Open

fix: route OCI artifact pulls through Docker Desktop HTTP proxy#13770
glours wants to merge 1 commit intomainfrom
fix/oci-resolver-dd-proxy

Conversation

@glours
Copy link
Copy Markdown
Contributor

@glours glours commented May 4, 2026

What I did
The compose process performs OCI artifact fetches in-process via containerd's docker resolver, whose default transport only honors HTTP_PROXY/HTTPS_PROXY/NO_PROXY env vars. Users behind PAC-only corporate proxies hit i/o timeouts on oci:// includes and on compose publish.

When Docker Desktop is the active engine and exposes httpproxy.sock, route the resolver through it (PAC-aware). Falls back to the default transport when DD is unavailable or the socket is missing. Modeled on docker/mcp-gateway PR #354.

Related issue
Internal customer feedback

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

Copilot AI review requested due to automatic review settings May 4, 2026 12:30
@glours glours requested a review from a team as a code owner May 4, 2026 12:30
@glours glours requested a review from ndeloof May 4, 2026 12:30
Copy link
Copy Markdown
Contributor

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 updates Compose’s OCI resolver usage so that, when Docker Desktop is the active engine and exposes httpproxy.sock, OCI registry traffic is routed through Docker Desktop’s PAC-aware HTTP proxy (improving behavior in PAC-only corporate proxy environments). It falls back when Docker Desktop/proxy socket detection fails.

Changes:

  • Add internal/desktop helpers to detect the Docker Desktop endpoint and build an HTTP transport that dials via httpproxy.sock.
  • Extend internal/oci.NewResolver to accept an optional http.RoundTripper, and thread that through oci:// remote loads and compose publish.
  • Add unit tests for the new proxy endpoint derivation and for ensuring the resolver uses a supplied transport.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/remote/oci.go Lazily initializes a resolver HTTP transport (via Docker Desktop proxy when available) and passes it into the OCI resolver for oci:// includes.
pkg/compose/publish.go Routes OCI publish traffic through Docker Desktop’s proxy transport when available.
pkg/compose/desktop.go Refactors Desktop endpoint detection to use internal/desktop.Endpoint.
internal/oci/resolver.go Adds a transport http.RoundTripper parameter to NewResolver and wires it into registry client configuration.
internal/oci/resolver_test.go Verifies NewResolver actually uses a provided transport and accepts nil transport.
internal/desktop/proxy.go Introduces Docker Desktop endpoint discovery and proxy transport construction (dialing httpproxy.sock).
internal/desktop/proxy_test.go Tests proxy socket endpoint derivation and transport fallback/routing behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/desktop/proxy.go Outdated
Comment thread internal/desktop/proxy.go
glours added a commit that referenced this pull request May 4, 2026
Address Copilot review on #13770:

- ProxyTransport now clones http.DefaultTransport and overrides only
  Proxy and DialContext, keeping stdlib timeouts, idle pool, and HTTP/2
  defaults (was a bare *http.Transport that dropped them).
- When DD is unavailable or detection fails, return nil instead of
  http.DefaultTransport so oci.NewResolver lets containerd use its own
  built-in default transport — preserving prior behavior for non-DD
  users.
glours added a commit that referenced this pull request May 4, 2026
Address Copilot review on #13770:

- ProxyTransport now clones http.DefaultTransport and overrides only
  Proxy and DialContext, keeping stdlib timeouts, idle pool, and HTTP/2
  defaults (was a bare *http.Transport that dropped them).
- When DD is unavailable or detection fails, return nil instead of
  http.DefaultTransport so oci.NewResolver lets containerd use its own
  built-in default transport — preserving prior behavior for non-DD
  users.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours glours force-pushed the fix/oci-resolver-dd-proxy branch from cd6cc46 to 8a8a913 Compare May 4, 2026 12:41
@glours glours requested a review from Copilot May 4, 2026 12:41
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/desktop/proxy.go
Comment thread internal/desktop/proxy.go Outdated
Comment thread internal/oci/resolver_test.go
The compose process performs OCI artifact fetches in-process via
containerd's docker resolver, whose default transport only honors
HTTP_PROXY/HTTPS_PROXY/NO_PROXY env vars. Users behind PAC-only
corporate proxies hit i/o timeouts on `oci://` includes and on
`compose publish`.

When Docker Desktop is the active engine and exposes httpproxy.sock,
route the resolver through it (PAC-aware). Falls back to the default
transport when DD is unavailable or the socket is missing. Modeled on
docker/mcp-gateway PR #354.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours glours force-pushed the fix/oci-resolver-dd-proxy branch from 4a29b97 to 9fb96a5 Compare May 4, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants