docker/cli ยท error
`--%s` flag requires the `--rotate` flag to update the CA
Error message
`--%s` flag requires the `--rotate` flag to update the CA
What it means
Error "`--%s` flag requires the `--rotate` flag to update the CA" thrown in docker/cli.
Source
Thrown at cli/command/swarm/ca.go:69
flags.Var(&opts.rootCAKey, flagCAKey, "Path to the PEM-formatted root CA key to use for the new cluster")
flags.BoolVarP(&opts.detach, "detach", "d", false, "Exit immediately instead of waiting for the root rotation to converge")
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress progress output")
return cmd
}
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{View on GitHub (pinned to e9452d6e78)
When it happens
Trigger: Thrown at cli/command/swarm/ca.go:69 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/715931a14791dea6.json.
Report an issue: GitHub.