forked from opencontainers/runc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
72 lines (62 loc) · 1.69 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"os"
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
)
const (
version = "0.2"
usage = `Open Container Project runtime
runc is a command line client for running applications packaged according to the Open Container Format (OCF) and is
a compliant implementation of the Open Container Project specification.
runc integrates well with existing process supervisors to provide a production container runtime environment for
applications. It can be used with your existing process monitoring tools and the container will be spawned as a direct
child of the process supervisor.
After creating a spec for your root filesystem with runc, you can execute a simple container in your shell by running:
cd /mycontainer
runc
`
)
func main() {
app := cli.NewApp()
app.Name = "runc"
app.Usage = usage
app.Version = version
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "id",
Value: getDefaultID(),
Usage: "specify the ID to be used for the container",
},
cli.BoolFlag{
Name: "debug",
Usage: "enable debug output for logging",
},
cli.StringFlag{
Name: "root",
Value: "/var/run/ocf",
Usage: "root directory for storage of container state (this should be located in tmpfs)",
},
cli.StringFlag{
Name: "criu",
Value: "criu",
Usage: "path to the criu binary used for checkpoint and restore",
},
}
app.Commands = []cli.Command{
checkpointCommand,
eventsCommand,
restoreCommand,
specCommand,
}
app.Before = func(context *cli.Context) error {
if context.GlobalBool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
}
app.Action = runAction
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}