fix: route OCI artifact pulls through Docker Desktop HTTP proxy#13770
fix: route OCI artifact pulls through Docker Desktop HTTP proxy#13770
Conversation
There was a problem hiding this comment.
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/desktophelpers to detect the Docker Desktop endpoint and build an HTTP transport that dials viahttpproxy.sock. - Extend
internal/oci.NewResolverto accept an optionalhttp.RoundTripper, and thread that throughoci://remote loads andcompose 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.
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.
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>
cd6cc46 to
8a8a913
Compare
There was a problem hiding this comment.
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.
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>
4a29b97 to
9fb96a5
Compare
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 oncompose 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
