@@ -30,6 +30,7 @@ import (
30
30
type createOptions struct {
31
31
Build bool
32
32
noBuild bool
33
+ Pull string
33
34
removeOrphans bool
34
35
ignoreOrphans bool
35
36
forceRecreate bool
@@ -71,6 +72,7 @@ func createCommand(p *projectOptions, backend api.Service) *cobra.Command {
71
72
flags := cmd .Flags ()
72
73
flags .BoolVar (& opts .Build , "build" , false , "Build images before starting containers." )
73
74
flags .BoolVar (& opts .noBuild , "no-build" , false , "Don't build an image, even if it's missing." )
75
+ flags .StringVar (& opts .Pull , "pull" , "missing" , `Pull image before running ("always"|"missing"|"never")` )
74
76
flags .BoolVar (& opts .forceRecreate , "force-recreate" , false , "Recreate containers even if their configuration and image haven't changed." )
75
77
flags .BoolVar (& opts .noRecreate , "no-recreate" , false , "If containers already exist, don't recreate them. Incompatible with --force-recreate." )
76
78
return cmd
@@ -105,6 +107,12 @@ func (opts createOptions) GetTimeout() *time.Duration {
105
107
}
106
108
107
109
func (opts createOptions ) Apply (project * types.Project ) {
110
+ if opts .Pull != "" {
111
+ for i , service := range project .Services {
112
+ service .PullPolicy = opts .Pull
113
+ project .Services [i ] = service
114
+ }
115
+ }
108
116
if opts .Build {
109
117
for i , service := range project .Services {
110
118
if service .Build == nil {
0 commit comments