diff --git a/main.go b/main.go index ac011f6151a..a23fbc1f32f 100644 --- a/main.go +++ b/main.go @@ -21,14 +21,14 @@ 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 config files for your root filesystem with runc, you can execute a -container in your shell by running: +After creating config files for your root filesystem with runc, you can execute +a container in your shell by running: # cd /mycontainer - # runc start [ -c spec-config-file ] [ -r runtime-config-file ] + # runc start [ -b bundle-dir ] -If not specified, the default value for the 'spec-config-file' is 'config.json', -and the default value for the 'runtime-config-file' is 'runtime.json'.` +If not specified, the default value for the 'bundle-dir' is './'. 'Bundle-dir' +is the location where 'config.json' and 'runtime.json' must be located.` ) func main() { diff --git a/restore.go b/restore.go index 919e9c970d6..3a2f57e80d2 100644 --- a/restore.go +++ b/restore.go @@ -50,14 +50,9 @@ var restoreCommand = cli.Command{ Usage: "cgroups mode: 'soft' (default), 'full' and 'strict'.", }, cli.StringFlag{ - Name: "config-file, c", - Value: "config.json", - Usage: "path to spec file for writing", - }, - cli.StringFlag{ - Name: "runtime-file, r", - Value: "runtime.json", - Usage: "path for runtime file for writing", + Name: "bundle-dir, b", + Value: "./", + Usage: "path to the root of the bundle directory", }, }, Action: func(context *cli.Context) { @@ -65,7 +60,13 @@ var restoreCommand = cli.Command{ if imagePath == "" { imagePath = getDefaultImagePath(context) } - spec, rspec, err := loadSpec(context.String("config-file"), context.String("runtime-file")) + bundleDir := context.String("bundle-dir") + if bundleDir != "./" { + if err := os.Chdir(bundleDir); err != nil { + fatal(err) + } + } + spec, rspec, err := loadSpec("config.json", "runtime.json") if err != nil { fatal(err) } diff --git a/spec.go b/spec.go index 69cf47b799a..9ae5ce05581 100644 --- a/spec.go +++ b/spec.go @@ -26,14 +26,9 @@ var specCommand = cli.Command{ Usage: "create a new specification file", Flags: []cli.Flag{ cli.StringFlag{ - Name: "config-file, c", - Value: "config.json", - Usage: "path to spec config file for writing", - }, - cli.StringFlag{ - Name: "runtime-file, r", - Value: "runtime.json", - Usage: "path to runtime config file for writing", + Name: "bundle-dir, b", + Value: "./", + Usage: "path to the root of the bundle directory", }, }, Action: func(context *cli.Context) { @@ -247,8 +242,14 @@ var specCommand = cli.Command{ } return nil } - cName := context.String("config-file") - rName := context.String("runtime-file") + bundleDir := context.String("bundle-dir") + if bundleDir != "./" { + if err := os.Chdir(bundleDir); err != nil { + fatal(err) + } + } + cName := "config.json" + rName := "runtime.json" if err := checkNoFile(cName); err != nil { logrus.Fatal(err) } diff --git a/start.go b/start.go index e047e610d2d..19f57a676a4 100644 --- a/start.go +++ b/start.go @@ -22,18 +22,19 @@ var startCommand = cli.Command{ Usage: "create and run a container", Flags: []cli.Flag{ cli.StringFlag{ - Name: "config-file, c", - Value: "config.json", - Usage: "path to spec config file", - }, - cli.StringFlag{ - Name: "runtime-file, r", - Value: "runtime.json", - Usage: "path to runtime config file", + Name: "bundle-dir, b", + Value: "./", + Usage: "path to the root of the bundle directory", }, }, Action: func(context *cli.Context) { - spec, rspec, err := loadSpec(context.String("config-file"), context.String("runtime-file")) + bundleDir := context.String("bundle-dir") + if bundleDir != "./" { + if err := os.Chdir(bundleDir); err != nil { + fatal(err) + } + } + spec, rspec, err := loadSpec("config.json", "runtime.json") if err != nil { fatal(err) }