Commit graph

2 commits

Author SHA1 Message Date
Domantas Petrauskas
0afb4c8c4c fix(publish): bypass Docker Desktop proxy for loopback registries
Some checks failed
ci / validate (lint) (push) Has been cancelled
ci / validate (validate-docs) (push) Has been cancelled
ci / validate (validate-go-mod) (push) Has been cancelled
ci / validate (validate-headers) (push) Has been cancelled
ci / binary (push) Has been cancelled
ci / bin-image-test (push) Has been cancelled
ci / test (push) Has been cancelled
ci / e2e (plugin, oldstable) (push) Has been cancelled
ci / e2e (standalone, oldstable) (push) Has been cancelled
ci / e2e (plugin, stable) (push) Has been cancelled
ci / e2e (standalone, stable) (push) Has been cancelled
merge / bin-image-prepare (push) Has been cancelled
merge / module-image (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
ci / binary-finalize (push) Has been cancelled
ci / coverage (push) Has been cancelled
ci / release (push) Has been cancelled
merge / bin-image (push) Has been cancelled
merge / desktop-edge-test (push) Has been cancelled
`docker compose publish` routed all registry traffic through Docker
Desktop's HTTP proxy. Publishing to a registry on localhost therefore
failed on Windows with:

    proxyconnect tcp: open ./pipe/dockerHttpProxy: The system cannot
    find the path specified.

even though `docker push`/`docker pull` worked against the same registry.

Two bugs in internal/desktop/proxy.go:

1. No loopback bypass. ProxyTransport forced every request through the
   Docker Desktop proxy and its DialContext always dialed the proxy
   socket, so loopback targets could never connect directly. Proxy
   selection now bypasses the proxy only for loopback targets
   (localhost, 127.0.0.0/8, ::1); all other registry traffic stays
   routed through Docker Desktop's PAC-aware proxy so Desktop keeps
   ownership of proxy decisions (e.g. enterprise-managed proxies). The
   local process NO_PROXY/no_proxy is deliberately not honored, so a
   broad value such as * or .corp cannot bypass centrally managed
   proxy policy.

2. Malformed Windows pipe path. The proxy named-pipe endpoint was
   hardcoded as npipe://./pipe/..., yielding the relative path
   ./pipe/dockerHttpProxy. It is now derived from the engine endpoint,
   preserving its namespace. Docker Desktop reports the backslash form
   npipe://\\.\pipe\docker_cli, so the derivation uses LastIndexAny to
   handle both backslash and forward-slash forms.

Publishing to localhost now connects directly like `docker push`, while
every non-loopback registry still goes through the Docker Desktop proxy.

Fixes #13824

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Domantas Petrauskas <dom.petrauskas@gmail.com>
2026-06-15 21:18:19 +02:00
Guillaume Lours
66c21c3b6c fix: route OCI artifact pulls through Docker Desktop HTTP proxy
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>
2026-05-18 10:53:23 +02:00