From 2657f5804e9e4f7c44b2c98af9204d3a5c900bf9 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Mon, 7 Dec 2020 15:48:57 +0100 Subject: [PATCH] Ensure down continues (removes networks) even if containers have been removed already. Avoid returning nil error and nil project in `projectFromContainerLabels` Signed-off-by: Guillaume Tardif --- local/compose.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/local/compose.go b/local/compose.go index 221aea24d..ea1fb330a 100644 --- a/local/compose.go +++ b/local/compose.go @@ -472,7 +472,7 @@ func (s *composeService) Down(ctx context.Context, projectName string) error { w := progress.ContextWriter(ctx) project, err := s.projectFromContainerLabels(ctx, projectName) - if err != nil || project == nil { + if err != nil { return err } @@ -547,17 +547,17 @@ func (s *composeService) projectFromContainerLabels(ctx context.Context, project if err != nil { return nil, err } + fakeProject := &types.Project{ + Name: projectName, + } if len(containers) == 0 { - return nil, nil + return fakeProject, nil } options, err := loadProjectOptionsFromLabels(containers[0]) if err != nil { return nil, err } if options.ConfigPaths[0] == "-" { - fakeProject := &types.Project{ - Name: projectName, - } for _, container := range containers { fakeProject.Services = append(fakeProject.Services, types.ServiceConfig{ Name: container.Labels[serviceLabel],