Skip to content

Commit

Permalink
Restore compose v1 behavior to recreate containers when ran with -V
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof authored and glours committed Sep 11, 2024
1 parent d445ebb commit a742443
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/compose/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func (opts createOptions) recreateStrategy() string {
if opts.forceRecreate {
return api.RecreateForce
}
if opts.noInherit {
return api.RecreateForce
}
return api.RecreateDiverged
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/compose/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ func validateFlags(up *upOptions, create *createOptions) error {
if up.Detach && (up.attachDependencies || up.cascadeStop || up.cascadeFail || len(up.attach) > 0 || up.watch) {
return fmt.Errorf("--detach cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch")
}
if create.noInherit && create.noRecreate {
return fmt.Errorf("--no-recreate and --renew-anon-volumes are incompatible")
}
if create.forceRecreate && create.noRecreate {
return fmt.Errorf("--force-recreate and --no-recreate are incompatible")
}
Expand Down

0 comments on commit a742443

Please sign in to comment.