mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Make startup errors a bit friendlier
A couple minor changes to error handling in startup: 1. Don't dump full help/usage text when the only problem is `runc` wasn't started under root privileges 2. Check for rootfs and make error clear to user when it doesn't exist 3. Change fatal to logrus.Fatal to get nicer output with simple error message Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
@@ -16,6 +17,12 @@ func execContainer(context *cli.Context, spec *LinuxSpec) (int, error) {
|
||||
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, err
|
||||
}
|
||||
rootuid, err := config.HostUID()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
|
||||
Reference in New Issue
Block a user