Skip to content

Commit

Permalink
log: add warning log
Browse files Browse the repository at this point in the history
Signed-off-by: Siyi Liao <stillfox.lee@gmail.com>
  • Loading branch information
stillfox-lee committed Dec 26, 2022
1 parent afa6c42 commit 7c89747
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/composer/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ func (c *Composer) Down(ctx context.Context, downOptions DownOptions) error {
if err != nil && downOptions.RemoveOrphans {
return fmt.Errorf("error getting orphaned containers: %s", err)
}
if len(orphans) > 0 && downOptions.RemoveOrphans {
if err := c.removeContainers(ctx, orphans, RemoveOptions{Stop: true, Volumes: downOptions.RemoveVolumes}); err != nil {
return fmt.Errorf("error removeing orphaned containers: %s", err)
if len(orphans) > 0 {
if downOptions.RemoveOrphans {
if err := c.removeContainers(ctx, orphans, RemoveOptions{Stop: true, Volumes: downOptions.RemoveVolumes}); err != nil {
return fmt.Errorf("error removeing orphaned containers: %s", err)
}
} else {
logrus.Warnf("found %d orphaned containers: %v, you can run this command with the --remove-orphans flag to clean it up", len(orphans), orphans)
}
}

Expand Down

0 comments on commit 7c89747

Please sign in to comment.