mirror of https://github.com/docker/compose.git
Merge pull request #9720 from glours/respect-pull-policy-build
don't apply default pull policy from command line if one is define in service configuration
This commit is contained in:
commit
359133b800
|
@ -31,6 +31,7 @@ type createOptions struct {
|
||||||
Build bool
|
Build bool
|
||||||
noBuild bool
|
noBuild bool
|
||||||
Pull string
|
Pull string
|
||||||
|
pullChanged bool
|
||||||
removeOrphans bool
|
removeOrphans bool
|
||||||
ignoreOrphans bool
|
ignoreOrphans bool
|
||||||
forceRecreate bool
|
forceRecreate bool
|
||||||
|
@ -47,7 +48,8 @@ func createCommand(p *projectOptions, backend api.Service) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "create [OPTIONS] [SERVICE...]",
|
Use: "create [OPTIONS] [SERVICE...]",
|
||||||
Short: "Creates containers for a service.",
|
Short: "Creates containers for a service.",
|
||||||
PreRunE: Adapt(func(ctx context.Context, args []string) error {
|
PreRunE: AdaptCmd(func(ctx context.Context, cmd *cobra.Command, args []string) error {
|
||||||
|
opts.pullChanged = cmd.Flags().Changed("pull")
|
||||||
if opts.Build && opts.noBuild {
|
if opts.Build && opts.noBuild {
|
||||||
return fmt.Errorf("--build and --no-build are incompatible")
|
return fmt.Errorf("--build and --no-build are incompatible")
|
||||||
}
|
}
|
||||||
|
@ -108,7 +110,7 @@ func (opts createOptions) GetTimeout() *time.Duration {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opts createOptions) Apply(project *types.Project) {
|
func (opts createOptions) Apply(project *types.Project) {
|
||||||
if opts.Pull != "" {
|
if opts.pullChanged {
|
||||||
for i, service := range project.Services {
|
for i, service := range project.Services {
|
||||||
service.PullPolicy = opts.Pull
|
service.PullPolicy = opts.Pull
|
||||||
project.Services[i] = service
|
project.Services[i] = service
|
||||||
|
|
Loading…
Reference in New Issue