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

Method Kill

pkg/composer/kill.go:31–53  ·  view source on GitHub ↗
(ctx context.Context, opts KillOptions, services []string)

Source from the content-addressed store, hash-verified

29}
30
31func (c *Composer) Kill(ctx context.Context, opts KillOptions, services []string) error {
32 serviceNames, err := c.ServiceNames(services...)
33 if err != nil {
34 return err
35 }
36 containers, err := c.Containers(ctx, serviceNames...)
37 if err != nil {
38 return err
39 }
40 eg, ctx := errgroup.WithContext(ctx)
41 for _, container := range containers {
42 container := container
43 eg.Go(func() error {
44 args := []string{"kill", "-s", opts.Signal, container.ID()}
45 if err := c.runNerdctlCmd(ctx, args...); err != nil {
46 log.G(ctx).Warn(err)
47 return err
48 }
49 return nil
50 })
51 }
52 return eg.Wait()
53}

Callers

nothing calls this directly

Calls 4

ServiceNamesMethod · 0.95
ContainersMethod · 0.95
runNerdctlCmdMethod · 0.95
WaitMethod · 0.45

Tested by

no test coverage detected