{"record":{"id":"86eb5176c99f2d48","repo":"docker/cli","slug":"s-is-only-supported-on-a-docker-daemon-with-e","errorCode":null,"errorMessage":"\"--%s\" is only supported on a Docker daemon with experimental features enabled","messagePattern":"\"--(.+?)\" is only supported on a Docker daemon with experimental features enabled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker/docker.go","lineNumber":700,"sourceCode":"\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() {\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","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cmd/docker/docker.go#L682-L718","documentation":"Thrown by areFlagsSupported() when a flag carrying the `experimental` annotation is set but details.ServerInfo().HasExperimental is false. The experimental capability is reported by the daemon during the ping; if the daemon was not started with experimental features enabled, this guard rejects the flag.","triggerScenarios":"Passing an experimental-annotated flag (e.g. early-stage flags) against a daemon that was not launched with --experimental.","commonSituations":"Using a flag that graduated from experimental on an older daemon that still gates it behind experimental; daemon config without `\"experimental\": true` in daemon.json; pointing at a stock daemon while testing preview features.","solutions":["Enable experimental features on the daemon: restart dockerd with --experimental, or set \"experimental\": true in /etc/docker/daemon.json and restart.","Remove the --<flag> if you do not need the experimental capability.","Upgrade the daemon/CLI — the flag may have become stable (annotation removed) in a newer version."],"exampleFix":"# before: dockerd without experimental\ndocker <cmd> --<experimental-flag>\n# after\n# /etc/docker/daemon.json\n{\"experimental\": true}\n# then\nsudo systemctl restart docker\ndocker <cmd> --<experimental-flag>","handlingStrategy":"validation","validationCode":"info, err := cli.ServerInfo(ctx)\nif err != nil { return err }\nif !info.HasExperimental { /* do not pass experimental flag */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize daemon.json with \"experimental\": true if preview flags are used.","Gate experimental flags behind a config check in automation.","Upgrade so flags graduate out of experimental."],"tags":["docker","cli","daemon","experimental","flag"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}