INNER CODE UNIT · Go
NewDockerCRICommand
Mirantis/cri-dockerd · cmd/server.go:44
func NewDockerCRICommand(stopCh <-chan struct{}) *cobra.Command {
cleanFlagSet := pflag.NewFlagSet(componentDockerCRI, pflag.ContinueOnError)
kubeletFlags := options.NewDockerCRIFlags()
cmd := &cobra.Command{
Use: componentDockerCRI,
Long: `CRI that connects to the Docker Daemon`,
// cri-dockerd has special flag parsing requirements to enforce flag precedence rules,
// so we do all our parsing manually in Run, below.
// DisableFlagParsing=true provides the full set of flags passed to cri-dockerd in the
// `args` arg to Run, without Cobra's interference.
DisableFlagParsing: true,
Run: func(cmd *cobra.Command, args []string) {
// initial flag parse, since we disable cobra's flag parsing
if err := cleanFlagSet.Parse(args); err != nil {
cmd.Usage()
logrus.Fatal(err)
}