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

Method Unpause

pkg/composer/pause.go:70–103  ·  view source on GitHub ↗

Unpause unpauses service containers belonging to `services`.

(ctx context.Context, services []string, writer io.Writer)

Source from the content-addressed store, hash-verified

68
69// Unpause unpauses service containers belonging to `services`.
70func (c *Composer) Unpause(ctx context.Context, services []string, writer io.Writer) error {
71 serviceNames, err := c.ServiceNames(services...)
72 if err != nil {
73 return err
74 }
75 containers, err := c.Containers(ctx, serviceNames...)
76 if err != nil {
77 return err
78 }
79
80 var mu sync.Mutex
81
82 eg, ctx := errgroup.WithContext(ctx)
83 for _, container := range containers {
84 container := container
85 eg.Go(func() error {
86 if err := containerutil.Unpause(ctx, c.client, container.ID(), c.config, c.NerdctlCmd, c.NerdctlArgs); err != nil {
87 return err
88 }
89 info, err := container.Info(ctx, containerd.WithoutRefreshedMetadata)
90 if err != nil {
91 return err
92 }
93
94 mu.Lock()
95 defer mu.Unlock()
96 _, err = fmt.Fprintln(writer, info.Labels[labels.Name])
97
98 return err
99 })
100 }
101
102 return eg.Wait()
103}

Callers 1

unpauseActionFunction · 0.80

Calls 6

ServiceNamesMethod · 0.95
ContainersMethod · 0.95
UnpauseFunction · 0.92
InfoMethod · 0.80
LockMethod · 0.65
WaitMethod · 0.45

Tested by

no test coverage detected