瀏覽代碼

Merge pull request #1300 from docker/start_recreate

introduce create --force-recreate and --no-recreate
Nicolas De loof 4 年之前
父節點
當前提交
d6c20045f0
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      cli/cmd/compose/create.go

+ 7 - 1
cli/cmd/compose/create.go

@@ -22,6 +22,8 @@ import (
 
 type createOptions struct {
 	*composeOptions
+	forceRecreate bool
+	noRecreate    bool
 }
 
 func createCommand(p *projectOptions) *cobra.Command {
@@ -37,11 +39,15 @@ func createCommand(p *projectOptions) *cobra.Command {
 					projectOptions: p,
 					Build:          opts.Build,
 				},
-				noStart: true,
+				noStart:       true,
+				forceRecreate: opts.forceRecreate,
+				noRecreate:    opts.noRecreate,
 			}, args)
 		},
 	}
 	flags := cmd.Flags()
 	flags.BoolVar(&opts.Build, "build", false, "Build images before starting containers.")
+	flags.BoolVar(&opts.forceRecreate, "force-recreate", false, "Recreate containers even if their configuration and image haven't changed.")
+	flags.BoolVar(&opts.noRecreate, "no-recreate", false, "If containers already exist, don't recreate them. Incompatible with --force-recreate.")
 	return cmd
 }