Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 4b20d77

Browse files
committed
Expose —remove-orphans in compose down command
Signed-off-by: Guillaume Tardif <[email protected]>
1 parent 7d0be7a commit 4b20d77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cli/cmd/compose/down.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131

3232
type downOptions struct {
3333
*projectOptions
34+
removeOrphans bool
3435
}
3536

3637
func downCommand(p *projectOptions) *cobra.Command {
@@ -44,6 +45,9 @@ func downCommand(p *projectOptions) *cobra.Command {
4445
return runDown(cmd.Context(), opts)
4546
},
4647
}
48+
flags := downCmd.Flags()
49+
flags.BoolVar(&opts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")
50+
4751
return downCmd
4852
}
4953

@@ -66,7 +70,7 @@ func runDown(ctx context.Context, opts downOptions) error {
6670
}
6771

6872
return name, c.ComposeService().Down(ctx, name, compose.DownOptions{
69-
RemoveOrphans: false,
73+
RemoveOrphans: opts.removeOrphans,
7074
Project: project,
7175
})
7276
})

0 commit comments

Comments
 (0)