mirror of https://github.com/docker/compose.git
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 <guillaume.tardif@gmail.com>
This commit is contained in:
parent
576aa46d21
commit
2657f5804e
|
@ -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],
|
||||
|
|
Loading…
Reference in New Issue