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 @@ -12,6 +12,16 @@ func CreateCommand(factory app.ProjectFactory) cli.Command {
12
12
Name : "create" ,
13
13
Usage : "Create all services but do not start" ,
14
14
Action : app .WithProject (factory , app .ProjectCreate ),
15
+ Flags : []cli.Flag {
16
+ cli.BoolFlag {
17
+ Name : "no-recreate" ,
18
+ Usage : "If containers already exist, don't recreate them. Incompatible with --force-recreate." ,
19
+ },
20
+ cli.BoolFlag {
21
+ Name : "force-recreate" ,
22
+ Usage : "Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate." ,
23
+ },
24
+ },
15
25
}
16
26
}
17
27
@@ -239,7 +249,7 @@ func Populate(context *project.Context, c *cli.Context) {
239
249
240
250
if c .Command .Name == "logs" {
241
251
context .Log = true
242
- } else if c .Command .Name == "up" {
252
+ } else if c .Command .Name == "up" || c . Command . Name == "create" {
243
253
context .Log = ! c .Bool ("d" )
244
254
context .NoRecreate = c .Bool ("no-recreate" )
245
255
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