mirror of
https://github.com/docker/compose.git
synced 2026-11-03 18:54:23 +00:00
introduce ability to select service to be stopped by compose down
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
68c462e607
commit
93bd27a0cc
6 changed files with 28 additions and 6 deletions
|
|
@ -44,7 +44,7 @@ func (s *composeService) Down(ctx context.Context, projectName string, options a
|
|||
}, s.stdinfo())
|
||||
}
|
||||
|
||||
func (s *composeService) down(ctx context.Context, projectName string, options api.DownOptions) error {
|
||||
func (s *composeService) down(ctx context.Context, projectName string, options api.DownOptions) error { //golint:nocyclo
|
||||
w := progress.ContextWriter(ctx)
|
||||
resourceToRemove := false
|
||||
|
||||
|
|
@ -70,6 +70,9 @@ func (s *composeService) down(ctx context.Context, projectName string, options a
|
|||
}
|
||||
|
||||
err = InReverseDependencyOrder(ctx, project, func(c context.Context, service string) error {
|
||||
if len(options.Services) > 0 && !utils.StringContains(options.Services, service) {
|
||||
return nil
|
||||
}
|
||||
serviceContainers := containers.filter(isService(service))
|
||||
err := s.removeContainers(ctx, w, serviceContainers, options.Timeout, options.Volumes)
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue