{"id":"7bee637052e9e7e8","repo":"docker/cli","slug":"invalid-storage-option","errorCode":null,"errorMessage":"invalid storage option","messagePattern":"invalid storage option","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":987,"sourceCode":"\tfor _, opt := range securityOpts {\n\t\tif opt == \"systempaths=unconfined\" {\n\t\t\tmaskedPaths = []string{}\n\t\t\treadonlyPaths = []string{}\n\t\t} else {\n\t\t\tfiltered = append(filtered, opt)\n\t\t}\n\t}\n\n\treturn filtered, maskedPaths, readonlyPaths\n}\n\n// parses storage options per container into a map\nfunc parseStorageOpts(storageOpts []string) (map[string]string, error) {\n\tm := make(map[string]string)\n\tfor _, option := range storageOpts {\n\t\tk, v, ok := strings.Cut(option, \"=\")\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"invalid storage option\")\n\t\t}\n\t\tm[k] = v\n\t}\n\treturn m, nil\n}\n\n// parseDevice parses a device mapping string to a container.DeviceMapping struct\nfunc parseDevice(device, serverOS string) (container.DeviceMapping, error) {\n\tswitch serverOS {\n\tcase \"linux\":\n\t\treturn parseLinuxDevice(device)\n\tcase \"windows\":\n\t\t// Windows doesn't support mapping, so passing the given value as-is.\n\t\treturn container.DeviceMapping{PathOnHost: device}, nil\n\tdefault:\n\t\treturn container.DeviceMapping{}, fmt.Errorf(\"unknown server OS: %s\", serverOS)\n\t}\n}","sourceCodeStart":969,"sourceCodeEnd":1005,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/opts.go#L969-L1005","documentation":"Raised in parseStorageOpts (opts.go:982-992) when a --storage-opt value does not contain an '=' separator. Storage options are forwarded to the daemon's storage driver as key=value pairs (e.g. size=10G for overlay2 on xfs), so a bare token cannot be turned into a map entry.","triggerScenarios":"`docker run --storage-opt size ...` or `--storage-opt 10G` — strings.Cut(option, \"=\") finds no '=', so any value without an equals sign fails; only the client-side format is checked here (key validity is checked later by the daemon).","commonSituations":"Forgetting the key, writing size:10G or 'size 10G' instead of size=10G; shell quoting that splits the option so only part of it reaches the flag; scripts building the option string from empty variables.","solutions":["Use key=value form: docker run --storage-opt size=20G ...","Quote the option if it contains shell-special characters: --storage-opt \"size=20G\"","Note that size= additionally requires a compatible storage driver setup (e.g. overlay2 on xfs with pquota, or windowsfilter) — the daemon validates that separately"],"exampleFix":"// before\ndocker run --storage-opt 20G ubuntu\n// after\ndocker run --storage-opt size=20G ubuntu","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","storage","flag-parsing","validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}