docker/cli ยท error

rotating to an external CA requires the `--%s` flag to speci

Error message

rotating to an external CA requires the `--%s` flag to specify the external CA's cert - to add an external CA with the current root CA certificate, use the `update` command instead

What it means

Error "rotating to an external CA requires the `--%s` flag to specify the external CA's cert - to add an external CA with the current root CA certificate, use the `update` command instead" thrown in docker/cli.

Source

Thrown at cli/command/swarm/ca.go:76

func runCA(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, opts caOptions) error {
	apiClient := dockerCLI.Client()

	res, err := apiClient.SwarmInspect(ctx, client.SwarmInspectOptions{})
	if err != nil {
		return err
	}

	if !opts.rotate {
		for _, f := range []string{flagCACert, flagCAKey, flagCertExpiry, flagExternalCA} {
			if flags.Changed(f) {
				return fmt.Errorf("`--%s` flag requires the `--rotate` flag to update the CA", f)
			}
		}
		return displayTrustRoot(dockerCLI.Out(), res)
	}

	if flags.Changed(flagExternalCA) && len(opts.externalCA.Value()) > 0 && !flags.Changed(flagCACert) {
		return fmt.Errorf(
			"rotating to an external CA requires the `--%s` flag to specify the external CA's cert - "+
				"to add an external CA with the current root CA certificate, use the `update` command instead", flagCACert)
	}

	if flags.Changed(flagCACert) && len(opts.externalCA.Value()) == 0 && !flags.Changed(flagCAKey) {
		return fmt.Errorf("the --%s flag requires that a --%s flag and/or --%s flag be provided as well",
			flagCACert, flagCAKey, flagExternalCA)
	}

	updateSwarmSpec(&res.Swarm.Spec, flags, opts)
	if _, err := apiClient.SwarmUpdate(ctx, client.SwarmUpdateOptions{
		Version: res.Swarm.Version,
		Spec:    res.Swarm.Spec,
	}); err != nil {
		return err
	}

	if opts.detach {

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/swarm/ca.go:76 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/7ff65b7347be2a39.json. Report an issue: GitHub.