summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd/restore.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2019-06-12 09:40:50 -0700
committerShentubot <shentubot@google.com>2019-06-12 09:41:50 -0700
commit356d1be140bb51f2a50d2c7fe24242cbfeedc9d6 (patch)
tree3685e89ffdf701c2e9aebb19023cf0606ca8593b /runsc/cmd/restore.go
parentdf110ad4fe571721a7eb4a5a1f9ce92584ef7809 (diff)
Allow 'runsc do' to run without root
'--rootless' flag lets a non-root user execute 'runsc do'. The drawback is that the sandbox and gofer processes will run as root inside a user namespace that is mapped to the caller's user, intead of nobody. And network is defaulted to '--network=host' inside the root network namespace. On the bright side, it's very convenient for testing: runsc --rootless do ls runsc --rootless do curl www.google.com PiperOrigin-RevId: 252840970
Diffstat (limited to 'runsc/cmd/restore.go')
-rw-r--r--runsc/cmd/restore.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/runsc/cmd/restore.go b/runsc/cmd/restore.go
index 3ab2f5676..a78a0dce6 100644
--- a/runsc/cmd/restore.go
+++ b/runsc/cmd/restore.go
@@ -80,25 +80,29 @@ func (r *Restore) Execute(_ context.Context, f *flag.FlagSet, args ...interface{
conf := args[0].(*boot.Config)
waitStatus := args[1].(*syscall.WaitStatus)
+ if conf.Rootless {
+ return Errorf("Rootless mode not supported with %q", r.Name())
+ }
+
bundleDir := r.bundleDir
if bundleDir == "" {
bundleDir = getwdOrDie()
}
spec, err := specutils.ReadSpec(bundleDir)
if err != nil {
- Fatalf("reading spec: %v", err)
+ return Errorf("reading spec: %v", err)
}
specutils.LogSpec(spec)
if r.imagePath == "" {
- Fatalf("image-path flag must be provided")
+ return Errorf("image-path flag must be provided")
}
conf.RestoreFile = filepath.Join(r.imagePath, checkpointFileName)
ws, err := container.Run(id, spec, conf, bundleDir, r.consoleSocket, r.pidFile, r.userLog, r.detach)
if err != nil {
- Fatalf("running container: %v", err)
+ return Errorf("running container: %v", err)
}
*waitStatus = ws