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

Method pause

pkg/compose/pause.go:35–52  ·  view source on GitHub ↗
(ctx context.Context, projectName string, options api.PauseOptions)

Source from the content-addressed store, hash-verified

33}
34
35func (s *composeService) pause(ctx context.Context, projectName string, options api.PauseOptions) error {
36 containers, err := s.getContainers(ctx, projectName, oneOffExclude, false, options.Services...)
37 if err != nil {
38 return err
39 }
40
41 if options.Project != nil {
42 containers = containers.filter(isService(options.Project.ServiceNames()...))
43 }
44
45 return forEachContainerConcurrent(ctx, containers, func(ctx context.Context, ctr container.Summary) error {
46 _, err := s.apiClient().ContainerPause(ctx, ctr.ID, client.ContainerPauseOptions{})
47 if err == nil {
48 s.events.On(newEvent(getContainerProgressName(ctr), api.Done, "Paused"))
49 }
50 return err
51 })
52}
53
54func (s *composeService) UnPause(ctx context.Context, projectName string, options api.PauseOptions) error {
55 return Run(ctx, func(ctx context.Context) error {

Callers 1

PauseMethod · 0.95

Calls 9

getContainersMethod · 0.95
apiClientMethod · 0.95
isServiceFunction · 0.85
newEventFunction · 0.85
getContainerProgressNameFunction · 0.85
filterMethod · 0.80
OnMethod · 0.65
ContainerPauseMethod · 0.45

Tested by

no test coverage detected