{"record":{"id":"ac4e5ad1e4e96a52","repo":"docker/compose","slug":"invalid-pull-option-q","errorCode":null,"errorMessage":"invalid --pull option %q","messagePattern":"invalid --pull option %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/create.go","lineNumber":168,"sourceCode":"\t}\n\tif opts.recreateDeps {\n\t\treturn api.RecreateForce\n\t}\n\treturn api.RecreateDiverged\n}\n\nfunc (opts createOptions) GetTimeout() *time.Duration {\n\tif opts.timeChanged {\n\t\tt := time.Duration(opts.timeout) * time.Second\n\t\treturn &t\n\t}\n\treturn nil\n}\n\nfunc (opts createOptions) Apply(project *types.Project) error {\n\tif opts.pullChanged {\n\t\tif !slices.Contains(validPullPolicies, opts.Pull) {\n\t\t\treturn fmt.Errorf(\"invalid --pull option %q\", opts.Pull)\n\t\t}\n\t\tfor i, service := range project.Services {\n\t\t\tservice.PullPolicy = opts.Pull\n\t\t\tproject.Services[i] = service\n\t\t}\n\t}\n\t// N.B. opts.Build means \"force build all\", but images can still be built\n\t// when this is false\n\t// e.g. if a service has pull_policy: build or its local image is policy\n\tif opts.Build {\n\t\tfor i, service := range project.Services {\n\t\t\tif service.Build == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tservice.PullPolicy = types.PullPolicyBuild\n\t\t\tproject.Services[i] = service\n\t\t}\n\t}","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/create.go#L150-L186","documentation":"The `--pull` flag on `docker compose create` (and commands reusing createOptions.Apply) accepts only the policies in validPullPolicies: always, missing, never, build. When `--pull` was explicitly set, Apply validates the value per service and rejects anything else.","triggerScenarios":"Running `docker compose create --pull if-not-present` (a `docker run` value) or `--pull always ` with a typo/empty value from a variable. The check only runs when the flag was explicitly changed (opts.pullChanged).","commonSituations":"Copying `--pull if-not-present` habits from `docker run`; empty CI variables expanding to `--pull \"\"`; older compose versions accepting different policy strings.","solutions":["Use one of: `--pull always`, `--pull missing`, `--pull never`, `--pull build` (note `policy` is only the flag's default display value, not an accepted explicit choice — check validPullPolicies in your version).","Default empty variables: `--pull \"${PULL:-missing}\"` and skip the flag entirely when unset.","Verify the exact accepted list with `docker compose create --help` for your installed version."],"exampleFix":"# before\ndocker compose create --pull if-not-present\n\n# after\ndocker compose create --pull missing","handlingStrategy":"validation","validationCode":"# bash\ncase \"${PULL:-}\" in \"\") ;; always|missing|never|build) PULL_FLAG=(--pull \"$PULL\");; *) echo \"invalid pull policy: $PULL\" >&2; exit 2;; esac\ndocker compose create \"${PULL_FLAG[@]}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember compose policies differ from docker run's if-not-present wording.","Skip the flag entirely when the variable is unset instead of passing an empty string."],"tags":["cli","create","pull-policy","flags","validation"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}