{"record":{"id":"6241517520b7527a","repo":"docker/compose","slug":"invalid-security-opt-q","errorCode":null,"errorMessage":"invalid security-opt: %q","messagePattern":"invalid security-opt: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/create.go","lineNumber":571,"sourceCode":"\n// copy/pasted from https://github.com/docker/cli/blob/9de1b162f/cli/command/container/opts.go#L673-L697 + RelativePath\n// TODO find so way to share this code with docker/cli\nfunc parseSecurityOpts(p *types.Project, securityOpts []string) ([]string, bool, error) {\n\tvar (\n\t\tunconfined bool\n\t\tparsed     []string\n\t)\n\tfor _, opt := range securityOpts {\n\t\tif opt == \"systempaths=unconfined\" {\n\t\t\tunconfined = true\n\t\t\tcontinue\n\t\t}\n\t\tcon := strings.SplitN(opt, \"=\", 2)\n\t\tif len(con) == 1 && con[0] != \"no-new-privileges\" {\n\t\t\tif strings.Contains(opt, \":\") {\n\t\t\t\tcon = strings.SplitN(opt, \":\", 2)\n\t\t\t} else {\n\t\t\t\treturn securityOpts, false, fmt.Errorf(\"invalid security-opt: %q\", opt)\n\t\t\t}\n\t\t}\n\t\tif con[0] == \"seccomp\" && con[1] != \"unconfined\" && con[1] != \"builtin\" {\n\t\t\tf, err := os.ReadFile(p.RelativePath(con[1]))\n\t\t\tif err != nil {\n\t\t\t\treturn securityOpts, false, fmt.Errorf(\"opening seccomp profile (%s) failed: %w\", con[1], err)\n\t\t\t}\n\t\t\tb := bytes.NewBuffer(nil)\n\t\t\tif err := json.Compact(b, f); err != nil {\n\t\t\t\treturn securityOpts, false, fmt.Errorf(\"compacting json for seccomp profile (%s) failed: %w\", con[1], err)\n\t\t\t}\n\t\t\tparsed = append(parsed, fmt.Sprintf(\"seccomp=%s\", b.Bytes()))\n\t\t} else {\n\t\t\tparsed = append(parsed, opt)\n\t\t}\n\t}\n\n\treturn parsed, unconfined, nil","sourceCodeStart":553,"sourceCodeEnd":589,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/create.go#L553-L589","documentation":"Error \"invalid security-opt: %q\" thrown in docker/compose.","triggerScenarios":"A security_opt entry does not follow the expected 'label=value' (or similar key=value) format and cannot be parsed.","commonSituations":"Missing '=' separator in options such as seccomp, apparmor, no-new-privileges, or label entries under security_opt.","solutions":["Fix the security_opt entry to a valid option such as no-new-privileges:true, seccomp=..., apparmor=..., or label=...","Remove the invalid security_opt entry from the compose file."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}