MCPcopy
hub / github.com/containerd/containerd / App

Function App

cmd/containerd/command/main.go:84–281  ·  view source on GitHub ↗

App returns a *cli.App instance.

()

Source from the content-addressed store, hash-verified

82
83// App returns a *cli.App instance.
84func App() *cli.App {
85 app := cli.NewApp()
86 app.Name = "containerd"
87 app.Version = version.Version
88 app.Usage = usage
89 app.Description = `
90containerd is a high performance container runtime whose daemon can be started
91by using this command. If none of the *config*, *publish*, *oci-hook*, or *help* commands
92are specified, the default action of the **containerd** command is to start the
93containerd daemon in the foreground.
94
95
96A default configuration is used if no TOML configuration is specified or located
97at the default file location. The *containerd config* command can be used to
98generate the default configuration for containerd. The output of that command
99can be used and modified as necessary as a custom configuration.`
100 app.Flags = []cli.Flag{
101 &cli.StringFlag{
102 Name: "config",
103 Aliases: []string{"c"},
104 Usage: "Path to the configuration file",
105 Value: filepath.Join(defaults.DefaultConfigDir, "config.toml"),
106 },
107 &cli.StringFlag{
108 Name: "log-level",
109 Aliases: []string{"l"},
110 Usage: "Set the logging level [trace, debug, info, warn, error, fatal, panic]",
111 },
112 &cli.StringFlag{
113 Name: "address",
114 Aliases: []string{"a"},
115 Usage: "Address for containerd's GRPC server",
116 },
117 &cli.StringFlag{
118 Name: "root",
119 Usage: "containerd root directory",
120 },
121 &cli.StringFlag{
122 Name: "state",
123 Usage: "containerd state directory",
124 },
125 }
126 app.Flags = append(app.Flags, serviceFlags()...)
127 app.Commands = []*cli.Command{
128 configCommand,
129 publishCommand,
130 ociHook,
131 }
132 app.Action = func(cliContext *cli.Context) error {
133 if args := cliContext.Args(); args.First() != "" {
134 return cli.ShowCommandHelp(cliContext, args.First())
135 }
136
137 var (
138 start = time.Now()
139 signals = make(chan os.Signal, 2048)
140 serverC = make(chan *server.Server, 1)
141 ctx, cancel = context.WithCancel(cliContext.Context)

Callers 2

mainFunction · 0.92
runFunction · 0.92

Calls 15

StopMethod · 0.95
StartMethod · 0.95
WaitMethod · 0.95
SetTempMountLocationFunction · 0.92
CleanupTempMountsFunction · 0.92
NewLogrusHookFunction · 0.92
WithTraceIDFieldFunction · 0.92
applyFlagsFunction · 0.85
FatalMethod · 0.80
serviceFlagsFunction · 0.70
defaultConfigFunction · 0.70

Tested by

no test coverage detected