{"record":{"id":"e1f231e003b1e0ea","repo":"docker/cli","slug":"s-is-only-supported-on-a-docker-daemon-runnin","errorCode":null,"errorMessage":"\"--%s\" is only supported on a Docker daemon running on %s, but the Docker daemon is running on %s","messagePattern":"\"--(.+?)\" is only supported on a Docker daemon running on (.+?), but the Docker daemon is running on (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker/docker.go","lineNumber":692,"sourceCode":"\n\tcmd.Flags().VisitAll(func(f *pflag.Flag) {\n\t\tif !f.Changed || len(f.Annotations) == 0 {\n\t\t\treturn\n\t\t}\n\t\t// Important: in the code below, calls to \"details.CurrentVersion()\" and\n\t\t// \"details.ServerInfo()\" are deliberately executed inline to make them\n\t\t// be executed \"lazily\". This is to prevent making a connection with the\n\t\t// daemon to perform a \"ping\" (even for flags that do not require a\n\t\t// daemon connection).\n\t\t//\n\t\t// See commit b39739123b845f872549e91be184cc583f5b387c for details.\n\n\t\tif _, ok := f.Annotations[\"version\"]; ok && !isVersionSupported(f, details.CurrentVersion()) {\n\t\t\terrs = append(errs, fmt.Errorf(`\"--%s\" requires API version %s, but the Docker daemon API version is %s`, f.Name, getFlagAnnotation(f, \"version\"), details.CurrentVersion()))\n\t\t\treturn\n\t\t}\n\t\tif _, ok := f.Annotations[\"ostype\"]; ok && !isOSTypeSupported(f, details.ServerInfo().OSType) {\n\t\t\terrs = append(errs, fmt.Errorf(\n\t\t\t\t`\"--%s\" is only supported on a Docker daemon running on %s, but the Docker daemon is running on %s`,\n\t\t\t\tf.Name,\n\t\t\t\tgetFlagAnnotation(f, \"ostype\"), details.ServerInfo().OSType),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif _, ok := f.Annotations[\"experimental\"]; ok && !details.ServerInfo().HasExperimental {\n\t\t\terrs = append(errs, fmt.Errorf(`\"--%s\" is only supported on a Docker daemon with experimental features enabled`, f.Name))\n\t\t}\n\t\t// buildkit-specific flags are noop when buildkit is not enabled, so we do not add an error in that case\n\t})\n\treturn errors.Join(errs...)\n}\n\n// Check recursively so that, e.g., `docker stack ls` returns the same output as `docker stack`\nfunc areSubcommandsSupported(cmd *cobra.Command, details versionDetails) error {\n\t// Check recursively so that, e.g., `docker stack ls` returns the same output as `docker stack`\n\tfor curr := cmd; curr != nil; curr = curr.Parent() {","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cmd/docker/docker.go#L674-L710","documentation":"Thrown by areFlagsSupported() when a CLI flag carrying the `ostype` annotation is set (f.Changed) but the connected daemon's reported OStype does not match the required value. The daemon's OStype is fetched lazily from ServerInfo() (a /v2.32.0 ping to the daemon). It tells the user the flag is platform-specific (e.g. a Windows-only flag) and the daemon is on a different platform.","triggerScenarios":"Running a docker command with a flag annotated ostype!=daemon-OSType (e.g. a flag requiring 'linux' on a Windows daemon) while that flag is explicitly passed on the command line.","commonSituations":"Pointing the CLI at a Windows Docker daemon while using Linux-only flags, or vice-versa; mixing Docker Desktop (linuxkit) flags against a native Windows/Mac daemon; scripting against a remote daemon whose OStype differs from the local assumption.","solutions":["Remove the unsupported --<flag> from your command (it is annotated for a different OStype).","Connect the CLI to a daemon running on the required OS (set DOCKER_HOST to the matching node).","Check `docker version` / `docker info` to confirm Server OSType before scripting."],"exampleFix":"# before (Windows daemon)\ndocker run --<linux-only-flag> ...\n# after: drop the flag or target a linux daemon\ndocker run ...\n# or\nDOCKER_HOST=tcp://linux-node:2375 docker run --<linux-only-flag> ...","handlingStrategy":"validation","validationCode":"// before invoking, confirm the daemon OS matches the flag's requirement\ninfo, err := cli.ServerInfo(ctx)\nif err != nil { return err }\nif info.OSType != \"linux\" { /* skip the linux-only flag */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `docker info` and read OSType before scripting platform-specific flags.","Pin DOCKER_HOST / use a known docker context for the required platform.","Avoid annotating your own commands with ostype unless the daemon matches."],"tags":["docker","cli","daemon","platform","ostype","flag"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}