{"record":{"id":"16c86c89d183cbca","repo":"docker/cli","slug":"s-is-only-supported-on-a-docker-daemon-running-on","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":723,"sourceCode":"}\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() {\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 commands 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 cmdVersion, ok := curr.Annotations[\"version\"]; ok && versions.LessThan(details.CurrentVersion(), cmdVersion) {\n\t\t\treturn fmt.Errorf(\"%s requires API version %s, but the Docker daemon API version is %s\", cmd.CommandPath(), cmdVersion, details.CurrentVersion())\n\t\t}\n\t\tif ost, ok := curr.Annotations[\"ostype\"]; ok && details.ServerInfo().OSType != \"\" && ost != details.ServerInfo().OSType {\n\t\t\treturn fmt.Errorf(\"%s is only supported on a Docker daemon running on %s, but the Docker daemon is running on %s\", cmd.CommandPath(), ost, details.ServerInfo().OSType)\n\t\t}\n\t\tif _, ok := curr.Annotations[\"experimental\"]; ok && !details.ServerInfo().HasExperimental {\n\t\t\treturn fmt.Errorf(\"%s is only supported on a Docker daemon with experimental features enabled\", cmd.CommandPath())\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc getFlagAnnotation(f *pflag.Flag, annotation string) string {\n\tif value, ok := f.Annotations[annotation]; ok && len(value) == 1 {\n\t\treturn value[0]\n\t}\n\treturn \"\"\n}\n\nfunc isVersionSupported(f *pflag.Flag, clientVersion string) bool {\n\tif v := getFlagAnnotation(f, \"version\"); v != \"\" {\n\t\treturn versions.GreaterThanOrEqualTo(clientVersion, v)","sourceCodeStart":705,"sourceCodeEnd":741,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cmd/docker/docker.go#L705-L741","documentation":"Subcommand-level mirror of error 580. Thrown by areSubcommandsSupported() when a command (or any ancestor) is annotated `ostype`, the daemon reports a non-empty OStype, and the two differ. The whole command is rejected because it only runs on a specific platform daemon.","triggerScenarios":"Running a command annotated for a specific OStype (e.g. a Windows-only subcommand) while connected to a daemon whose OStype differs and is non-empty.","commonSituations":"Running Linux-only orchestrator commands against a Windows container host; CI using a remote daemon of a different OS family; Docker Desktop context switch leaving the CLI talking to the wrong kit.","solutions":["Switch the CLI to a daemon of the required OStype (correct DOCKER_HOST / context).","Use the equivalent command supported on the current daemon's platform.","Verify with `docker info` ( OSType field) before running."],"exampleFix":"# before: command needs linux, daemon is windows\ndocker context use windows-node\ndocker <linux-only-cmd>\n# after\ndocker context use linux-node\ndocker <linux-only-cmd>","handlingStrategy":"validation","validationCode":"info, err := cli.ServerInfo(ctx)\nif err != nil { return err }\nif info.OSType != wantOS { return fmt.Errorf(\"daemon OS %q != required %q\", info.OSType, wantOS) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Select a docker context whose daemon matches the command's required OS.","Check `docker info` OSType in pipelines before platform-specific commands."],"tags":["docker","cli","daemon","platform","ostype","subcommand"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}