mirror of
https://github.com/docker/compose.git
synced 2025-07-29 00:24:12 +02:00
Merge pull request #1231 from gtardif/compose_down_remove_orphans
Expose `—remove-orphans` in compose down command
This commit is contained in:
commit
74107bf512
@ -31,6 +31,7 @@ import (
|
|||||||
|
|
||||||
type downOptions struct {
|
type downOptions struct {
|
||||||
*projectOptions
|
*projectOptions
|
||||||
|
removeOrphans bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func downCommand(p *projectOptions) *cobra.Command {
|
func downCommand(p *projectOptions) *cobra.Command {
|
||||||
@ -44,6 +45,9 @@ func downCommand(p *projectOptions) *cobra.Command {
|
|||||||
return runDown(cmd.Context(), opts)
|
return runDown(cmd.Context(), opts)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
flags := downCmd.Flags()
|
||||||
|
flags.BoolVar(&opts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")
|
||||||
|
|
||||||
return downCmd
|
return downCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +70,7 @@ func runDown(ctx context.Context, opts downOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return name, c.ComposeService().Down(ctx, name, compose.DownOptions{
|
return name, c.ComposeService().Down(ctx, name, compose.DownOptions{
|
||||||
RemoveOrphans: false,
|
RemoveOrphans: opts.removeOrphans,
|
||||||
Project: project,
|
Project: project,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user