{"record":{"id":"19e0c96e535bcfab","repo":"docker/cli","slug":"s-is-not-an-absolute-path","errorCode":null,"errorMessage":"%s is not an absolute path","messagePattern":"(.+?) is not an absolute path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":1128,"sourceCode":"\t\tif isValid := validator(split[1]); isValid {\n\t\t\tcontainerPath = split[0]\n\t\t\tmode = split[1]\n\t\t\tval = fmt.Sprintf(\"%s:%s\", path.Clean(containerPath), mode)\n\t\t} else {\n\t\t\tcontainerPath = split[1]\n\t\t\tval = fmt.Sprintf(\"%s:%s\", split[0], path.Clean(containerPath))\n\t\t}\n\tcase 3:\n\t\tcontainerPath = split[1]\n\t\tmode = split[2]\n\t\tif isValid := validator(split[2]); !isValid {\n\t\t\treturn val, fmt.Errorf(\"bad mode specified: %s\", mode)\n\t\t}\n\t\tval = fmt.Sprintf(\"%s:%s:%s\", split[0], containerPath, mode)\n\t}\n\n\tif !path.IsAbs(containerPath) {\n\t\treturn val, fmt.Errorf(\"%s is not an absolute path\", containerPath)\n\t}\n\treturn val, nil\n}\n\n// validateAttach validates that the specified string is a valid attach option.\nfunc validateAttach(val string) (string, error) {\n\ts := strings.ToLower(val)\n\tif slices.Contains([]string{\"stdin\", \"stdout\", \"stderr\"}, s) {\n\t\treturn s, nil\n\t}\n\treturn val, errors.New(\"valid streams are STDIN, STDOUT and STDERR\")\n}\n\nfunc toNetipAddrSlice(ips []string) []netip.Addr {\n\tif len(ips) == 0 {\n\t\treturn nil\n\t}\n\tnetIPs := make([]netip.Addr, 0, len(ips))","sourceCodeStart":1110,"sourceCodeEnd":1146,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/container/opts.go#L1110-L1146","documentation":"Thrown by validateLinuxPath when the resolved container path is not absolute (path.IsAbs returns false). The container-side path must start with '/'.","triggerScenarios":"Passing a relative path as the container destination, e.g. `--device /dev/sda1:relative/path` or `--mount` style with non-absolute container path. The check runs after path.Clean on the container path.","commonSituations":"Assuming the path is relative to the container's workdir; forgetting the leading slash; script interpolation that strips it.","solutions":["Prefix the container path with '/', e.g. /dev/sda1:/mnt/data","Use an absolute path for the container destination"],"exampleFix":"# before\ndocker run --device /dev/sda1:data ...\n# after\ndocker run --device /dev/sda1:/data ...","handlingStrategy":"validation","validationCode":"func validAbsContainerPath(spec string) error {\n    parts := strings.SplitN(spec, \":\", 3)\n    containerPath := parts[len(parts)-1]\n    if len(parts) == 3 {\n        containerPath = parts[1]\n    }\n    if !filepath.IsAbs(containerPath) {\n        return fmt.Errorf(\"container path %q must be absolute\", containerPath)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always construct container paths with a leading '/' in templates"],"tags":["docker","device","path","absolute-path"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}