docker/cli ยท error

specify only one -H

Error message

specify only one -H

What it means

Error "specify only one -H" thrown in docker/cli.

Source

Thrown at cli/flags/options.go:81

// slice. It produces an error when trying to set multiple values, matching
// the check in [getServerHost].
//
// [getServerHost]: https://github.com/docker/cli/blob/7eab668982645def1cd46fe1b60894cba6fd17a4/cli/command/cli.go#L542-L551
type hostVar struct {
	dst *[]string
	set bool
}

func (h *hostVar) String() string {
	if h.dst == nil || len(*h.dst) == 0 {
		return ""
	}
	return (*h.dst)[0]
}

func (h *hostVar) Set(s string) error {
	if h.set {
		return errors.New("specify only one -H")
	}
	*h.dst = []string{s}
	h.set = true
	return nil
}

func (*hostVar) Type() string { return "string" }

// ClientOptions are the options used to configure the client cli.
type ClientOptions struct {
	Debug      bool
	Hosts      []string
	LogLevel   string
	TLS        bool
	TLSVerify  bool
	TLSOptions *tlsconfig.Options
	Context    string
	ConfigDir  string

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/flags/options.go:81 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/232fcff43eb5c47e.json. Report an issue: GitHub.