Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions image/docker/docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,11 @@ func (c *dockerClient) detectPropertiesHelper(ctx context.Context) error {
if c.sys != nil && c.sys.DockerProxyURL != nil {
tr.Proxy = http.ProxyURL(c.sys.DockerProxyURL)
}
if c.sys != nil && c.sys.DockerProxy != nil {
tr.Proxy = func(request *http.Request) (*url.URL, error) {
return c.sys.DockerProxy(request.URL)
}
}
c.client = &http.Client{Transport: tr}

ping := func(scheme string) error {
Expand Down
4 changes: 4 additions & 0 deletions image/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@ type SystemContext struct {
DockerRegistryPushPrecomputeDigests bool
// DockerProxyURL specifies proxy configuration schema (like socks5://username:password@ip:port)
DockerProxyURL *url.URL
// DockerProxy is a function that determines the proxy URL for a given request URL.
// If set, this takes precedence over DockerProxyURL. The function should return the proxy URL to use,
// or nil if no proxy should be used for the given request.
DockerProxy func(reqURL *url.URL) (*url.URL, error)

// === docker/daemon.Transport overrides ===
// A directory containing a CA certificate (ending with ".crt"),
Expand Down
Loading