docker/cli · error

is only supported on a Docker daemon running on , but the…

Error message

%s is only supported on a Docker daemon running on %s, but the Docker daemon is running on %s

What it means

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.

Solutions

  1. Switch the CLI to a daemon of the required OStype (correct DOCKER_HOST / context).
  2. Use the equivalent command supported on the current daemon's platform.
  3. Verify with `docker info` ( OSType field) before running.

Example fix

# before: command needs linux, daemon is windows
docker context use windows-node
docker <linux-only-cmd>
# after
docker context use linux-node
docker <linux-only-cmd>
Defensive patterns

Strategy: validation

Validate before calling

info, err := cli.ServerInfo(ctx)
if err != nil { return err }
if info.OSType != wantOS { return fmt.Errorf("daemon OS %q != required %q", info.OSType, wantOS) }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07). Data as JSON: /api/errors/16c86c89d183cbca. Report an issue: GitHub.

Appendix: source

Thrown at cmd/docker/docker.go:723

}

// Check recursively so that, e.g., `docker stack ls` returns the same output as `docker stack`
func areSubcommandsSupported(cmd *cobra.Command, details versionDetails) error {
	// Check recursively so that, e.g., `docker stack ls` returns the same output as `docker stack`
	for curr := cmd; curr != nil; curr = curr.Parent() {
		// Important: in the code below, calls to "details.CurrentVersion()" and
		// "details.ServerInfo()" are deliberately executed inline to make them
		// be executed "lazily". This is to prevent making a connection with the
		// daemon to perform a "ping" (even for commands that do not require a
		// daemon connection).
		//
		// See commit b39739123b845f872549e91be184cc583f5b387c for details.

		if cmdVersion, ok := curr.Annotations["version"]; ok && versions.LessThan(details.CurrentVersion(), cmdVersion) {
			return fmt.Errorf("%s requires API version %s, but the Docker daemon API version is %s", cmd.CommandPath(), cmdVersion, details.CurrentVersion())
		}
		if ost, ok := curr.Annotations["ostype"]; ok && details.ServerInfo().OSType != "" && ost != details.ServerInfo().OSType {
			return 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)
		}
		if _, ok := curr.Annotations["experimental"]; ok && !details.ServerInfo().HasExperimental {
			return fmt.Errorf("%s is only supported on a Docker daemon with experimental features enabled", cmd.CommandPath())
		}
	}
	return nil
}

func getFlagAnnotation(f *pflag.Flag, annotation string) string {
	if value, ok := f.Annotations[annotation]; ok && len(value) == 1 {
		return value[0]
	}
	return ""
}

func isVersionSupported(f *pflag.Flag, clientVersion string) bool {
	if v := getFlagAnnotation(f, "version"); v != "" {
		return versions.GreaterThanOrEqualTo(clientVersion, v)

View on GitHub (pinned to 4f84911bfe)