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

Function IsFeatureActiveStandalone

internal/desktop/client.go:202–213  ·  view source on GitHub ↗

IsFeatureActiveStandalone is the convenience form of IsFeatureActive for callers without an existing engine API client (e.g. the compose plugin hook subprocess). It builds a Docker CLI using the ambient environment to resolve the active context, then delegates to IsFeatureActive.

(ctx context.Context, feature string)

Source from the content-addressed store, hash-verified

200// subprocess). It builds a Docker CLI using the ambient environment to
201// resolve the active context, then delegates to IsFeatureActive.
202func IsFeatureActiveStandalone(ctx context.Context, feature string) bool {
203 dockerCli, err := command.NewDockerCli(command.WithCombinedStreams(io.Discard))
204 if err != nil {
205 return false
206 }
207 if err := dockerCli.Initialize(cliflags.NewClientOptions()); err != nil {
208 return false
209 }
210 defer dockerCli.Client().Close() //nolint:errcheck
211
212 return IsFeatureActive(ctx, dockerCli.Client(), feature)
213}
214
215func (c *Client) newRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error) {
216 req, err := http.NewRequestWithContext(ctx, method, backendURL(path), body)

Callers 1

hooks.goFile · 0.92

Calls 3

IsFeatureActiveFunction · 0.85
CloseMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected