From 2d148faedfb7e7e929e7a28dd2a1510b6b6199d2 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 25 Nov 2024 11:34:26 +0100 Subject: [PATCH] use service.stop to stop dependent containers Signed-off-by: Nicolas De Loof --- pkg/compose/convergence.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/compose/convergence.go b/pkg/compose/convergence.go index bb54e8c08b..3d9da7f1ac 100644 --- a/pkg/compose/convergence.go +++ b/pkg/compose/convergence.go @@ -224,15 +224,18 @@ func (c *convergence) ensureService(ctx context.Context, project *types.Project, } func (c *convergence) stopDependentContainers(ctx context.Context, project *types.Project, service types.ServiceConfig) error { - w := progress.ContextWriter(ctx) // Stop dependent containers, so they will be restarted after service is re-created dependents := project.GetDependentsForService(service) + err := c.service.stop(ctx, project.Name, api.StopOptions{ + Services: dependents, + Project: project, + }) + if err != nil { + return err + } + for _, name := range dependents { dependents := c.getObservedState(name) - err := c.service.stopContainers(ctx, w, &service, dependents, nil) - if err != nil { - return err - } for i, dependent := range dependents { dependent.State = ContainerExited dependents[i] = dependent