@@ -30,6 +30,7 @@ import (
3030type createOptions struct {
3131 Build bool
3232 noBuild bool
33+ Pull string
3334 removeOrphans bool
3435 ignoreOrphans bool
3536 forceRecreate bool
@@ -71,6 +72,7 @@ func createCommand(p *projectOptions, backend api.Service) *cobra.Command {
7172 flags := cmd .Flags ()
7273 flags .BoolVar (& opts .Build , "build" , false , "Build images before starting containers." )
7374 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")` )
7476 flags .BoolVar (& opts .forceRecreate , "force-recreate" , false , "Recreate containers even if their configuration and image haven't changed." )
7577 flags .BoolVar (& opts .noRecreate , "no-recreate" , false , "If containers already exist, don't recreate them. Incompatible with --force-recreate." )
7678 return cmd
@@ -105,6 +107,12 @@ func (opts createOptions) GetTimeout() *time.Duration {
105107}
106108
107109func (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+ }
108116 if opts .Build {
109117 for i , service := range project .Services {
110118 if service .Build == nil {
0 commit comments