MCPcopy Index your code
hub / github.com/docker/cli / runStop

Function runStop

cli/command/container/stop.go:59–82  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, opts *stopOptions)

Source from the content-addressed store, hash-verified

57}
58
59func runStop(ctx context.Context, dockerCLI command.Cli, opts *stopOptions) error {
60 var timeout *int
61 if opts.timeoutChanged {
62 timeout = &opts.timeout
63 }
64
65 apiClient := dockerCLI.Client()
66 errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, id string) error {
67 _, err := apiClient.ContainerStop(ctx, id, client.ContainerStopOptions{
68 Signal: opts.signal,
69 Timeout: timeout,
70 })
71 return err
72 })
73 var errs []error
74 for _, ctr := range opts.containers {
75 if err := <-errChan; err != nil {
76 errs = append(errs, err)
77 continue
78 }
79 _, _ = fmt.Fprintln(dockerCLI.Out(), ctr)
80 }
81 return errors.Join(errs...)
82}

Callers 1

newStopCommandFunction · 0.85

Calls 4

parallelOperationFunction · 0.85
ContainerStopMethod · 0.80
ClientMethod · 0.65
OutMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…