Skip to content

Commit a742443

Browse files
ndeloofglours
authored andcommitted
Restore compose v1 behavior to recreate containers when ran with -V
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent d445ebb commit a742443

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cmd/compose/create.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ func (opts createOptions) recreateStrategy() string {
117117
if opts.forceRecreate {
118118
return api.RecreateForce
119119
}
120+
if opts.noInherit {
121+
return api.RecreateForce
122+
}
120123
return api.RecreateDiverged
121124
}
122125

cmd/compose/up.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ func validateFlags(up *upOptions, create *createOptions) error {
189189
if up.Detach && (up.attachDependencies || up.cascadeStop || up.cascadeFail || len(up.attach) > 0 || up.watch) {
190190
return fmt.Errorf("--detach cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch")
191191
}
192+
if create.noInherit && create.noRecreate {
193+
return fmt.Errorf("--no-recreate and --renew-anon-volumes are incompatible")
194+
}
192195
if create.forceRecreate && create.noRecreate {
193196
return fmt.Errorf("--force-recreate and --no-recreate are incompatible")
194197
}

0 commit comments

Comments
 (0)