MCPcopy
hub / github.com/docker/compose / Endpoint

Function Endpoint

internal/desktop/proxy.go:43–54  ·  view source on GitHub ↗

Endpoint returns the Docker Desktop API socket endpoint advertised via the engine info labels, or "" when the active engine is not Docker Desktop.

(ctx context.Context, apiClient client.APIClient)

Source from the content-addressed store, hash-verified

41// Endpoint returns the Docker Desktop API socket endpoint advertised via the
42// engine info labels, or "" when the active engine is not Docker Desktop.
43func Endpoint(ctx context.Context, apiClient client.APIClient) (string, error) {
44 res, err := apiClient.Info(ctx, client.InfoOptions{})
45 if err != nil {
46 return "", err
47 }
48 for _, l := range res.Info.Labels {
49 if k, v, ok := strings.Cut(l, "="); ok && k == EngineLabel {
50 return v, nil
51 }
52 }
53 return "", nil
54}
55
56// httpProxySocketEndpoint derives Docker Desktop's HTTP proxy socket endpoint
57// from a Docker Desktop socket endpoint in the same directory. Returns ""

Callers 3

ProxyTransportForFunction · 0.85
IsFeatureActiveFunction · 0.85

Calls 1

InfoMethod · 0.45

Tested by

no test coverage detected