This repository was archived by the owner on Jul 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ func CreateCommand(factory app.ProjectFactory) cli.Command {
14
14
Name : "create" ,
15
15
Usage : "Create all services but do not start" ,
16
16
Action : app .WithProject (factory , app .ProjectCreate ),
17
+ Flags : []cli.Flag {
18
+ cli.BoolFlag {
19
+ Name : "no-recreate" ,
20
+ Usage : "If containers already exist, don't recreate them. Incompatible with --force-recreate." ,
21
+ },
22
+ cli.BoolFlag {
23
+ Name : "force-recreate" ,
24
+ Usage : "Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate." ,
25
+ },
26
+ },
17
27
}
18
28
}
19
29
@@ -269,7 +279,7 @@ func Populate(context *project.Context, c *cli.Context) {
269
279
270
280
if c .Command .Name == "logs" {
271
281
context .Log = true
272
- } else if c .Command .Name == "up" {
282
+ } else if c .Command .Name == "up" || c . Command . Name == "create" {
273
283
context .Log = ! c .Bool ("d" )
274
284
context .NoRecreate = c .Bool ("no-recreate" )
275
285
context .ForceRecreate = c .Bool ("force-recreate" )
Original file line number Diff line number Diff line change @@ -41,11 +41,22 @@ func (s *Service) DependentServices() []project.ServiceRelationship {
41
41
42
42
// Create implements Service.Create.
43
43
func (s * Service ) Create () error {
44
+ containers , err := s .collectContainers ()
45
+ if err != nil {
46
+ return err
47
+ }
48
+
44
49
imageName , err := s .build ()
45
50
if err != nil {
46
51
return err
47
52
}
48
53
54
+ if len (containers ) != 0 {
55
+ return s .eachContainer (func (c * Container ) error {
56
+ return s .recreateIfNeeded (imageName , c )
57
+ })
58
+ }
59
+
49
60
_ , err = s .createOne (imageName )
50
61
return err
51
62
}
You can’t perform that action at this time.
0 commit comments