mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Merge pull request #541 from crosbymichael/ids
Require container id as arg1
This commit is contained in:
@@ -84,13 +84,17 @@ func init() {
|
||||
}
|
||||
|
||||
func startContainer(context *cli.Context, spec *specs.LinuxSpec) (int, error) {
|
||||
config, err := createLibcontainerConfig(context.GlobalString("id"), spec)
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return -1, errEmptyID
|
||||
}
|
||||
config, err := createLibcontainerConfig(id, spec)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
if _, err := os.Stat(config.Rootfs); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return -1, fmt.Errorf("Rootfs (%q) does not exist", config.Rootfs)
|
||||
return -1, fmt.Errorf("rootfs (%q) does not exist", config.Rootfs)
|
||||
}
|
||||
return -1, err
|
||||
}
|
||||
@@ -102,7 +106,7 @@ func startContainer(context *cli.Context, spec *specs.LinuxSpec) (int, error) {
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
container, err := factory.Create(context.GlobalString("id"), config)
|
||||
container, err := factory.Create(id, config)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user