introduce --renew-anon-volumes

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-03-02 08:38:15 +01:00
parent dd843bded8
commit 7c4c534b36
No known key found for this signature in database
GPG key ID: 9858809D6F8F6E7E
4 changed files with 17 additions and 7 deletions

View file

@ -65,6 +65,7 @@ type upOptions struct {
timeChanged bool
timeout int
noDeps bool
noInherit bool
}
func (o upOptions) recreateStrategy() string {
@ -129,6 +130,7 @@ func upCommand(p *projectOptions, contextType string) *cobra.Command {
flags.StringVar(&opts.exitCodeFrom, "exit-code-from", "", "Return the exit code of the selected service container. Implies --abort-on-container-exit")
flags.IntVarP(&opts.timeout, "timeout", "t", 10, "Use this timeout in seconds for container shutdown when attached or when containers are already running.")
flags.BoolVar(&opts.noDeps, "no-deps", false, "Don't start linked services.")
flags.BoolVarP(&opts.noInherit, "renew-anon-volumes", "V", false, "Recreate anonymous volumes instead of retrieving data from the previous containers.")
}
return upCmd
@ -192,6 +194,7 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
err := c.ComposeService().Create(ctx, project, compose.CreateOptions{
RemoveOrphans: opts.removeOrphans,
Recreate: opts.recreateStrategy(),
Inherit: !opts.noInherit,
})
if err != nil {
return "", err