MCPcopy Create free account
hub / github.com/containerd/nerdctl / Stop

Method Stop

pkg/composer/stop.go:39–55  ·  view source on GitHub ↗

Stop stops containers in `services` without removing them. It calls `nerdctl stop CONTAINER_ID` to do the actual job.

(ctx context.Context, opt StopOptions, services []string)

Source from the content-addressed store, hash-verified

37// Stop stops containers in `services` without removing them. It calls
38// `nerdctl stop CONTAINER_ID` to do the actual job.
39func (c *Composer) Stop(ctx context.Context, opt StopOptions, services []string) error {
40 serviceNames, err := c.ServiceNames(services...)
41 if err != nil {
42 return err
43 }
44 // reverse dependency order
45 for _, svc := range strutil.ReverseStrSlice(serviceNames) {
46 containers, err := c.Containers(ctx, svc)
47 if err != nil {
48 return err
49 }
50 if err := c.stopContainers(ctx, containers, opt); err != nil {
51 return err
52 }
53 }
54 return nil
55}
56
57func (c *Composer) stopContainers(ctx context.Context, containers []containerd.Container, opt StopOptions) error {
58 var timeoutArg string

Callers 6

getContainerWaitFunction · 0.80
PushFunction · 0.80
ShowProgressFunction · 0.80
StatsFunction · 0.80
StopCatchFunction · 0.80
stopActionFunction · 0.80

Calls 4

ServiceNamesMethod · 0.95
ContainersMethod · 0.95
stopContainersMethod · 0.95
ReverseStrSliceFunction · 0.92

Tested by

no test coverage detected