code: func resolveContextName(opts *cliflags.CommonOptions, config *configfile.ConfigFile, contextstore store.Reader) (string, error) {
  	if opts.Context != "" && len(opts.Hosts) > 0 {
  		return "", errors.New("Conflicting options: either specify --host or --context, not both")
  	}
  	if opts.Context != "" {
  		return opts.Context, nil
  	}
  	if len(opts.Hosts) > 0 {
  		return DefaultContextName, nil
  	}
  	if _, present := os.LookupEnv("DOCKER_HOST"); present {
  		return DefaultContextName, nil
  	}
  	if ctxName, ok := os.LookupEnv("DOCKER_CONTEXT"); ok {
  		return ctxName, nil
  	}
  	if config != nil && config.CurrentContext != "" {
  		_, err := contextstore.GetMetadata(config.CurrentContext)
  		if store.IsErrContextDoesNotExist(err) {
  			return "", errors.Errorf("Current context %q is not found on the file system, please check your config file at %s", config.CurrentContext, config.Filename)
  		}
  		return config.CurrentContext, err
  	}
  	return DefaultContextName, nil
  }
docs: // resolveContextName resolves the current context name with the following rules:
  // - setting both --context and --host flags is ambiguous
  // - if --context is set, use this value
  // - if --host flag or DOCKER_HOST is set, fallbacks to use the same logic as before context-store was added
  // for backward compatibility with existing scripts
  // - if DOCKER_CONTEXT is set, use this value
  // - if Config file has a globally set "CurrentContext", use this value
  // - fallbacks to default HOST, uses TLS config from flags/env vars