summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'runsc/cmd')
-rw-r--r--runsc/cmd/do.go2
-rw-r--r--runsc/cmd/restore.go18
-rw-r--r--runsc/cmd/run.go6
3 files changed, 12 insertions, 14 deletions
diff --git a/runsc/cmd/do.go b/runsc/cmd/do.go
index 842fe2341..c5e72f32b 100644
--- a/runsc/cmd/do.go
+++ b/runsc/cmd/do.go
@@ -144,7 +144,7 @@ func (c *Do) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) su
Fatalf("Error write spec: %v", err)
}
- ws, err := container.Run(cid, spec, conf, tmpDir, "", "", "")
+ ws, err := container.Run(cid, spec, conf, tmpDir, "", "", "", false)
if err != nil {
Fatalf("running container: %v", err)
}
diff --git a/runsc/cmd/restore.go b/runsc/cmd/restore.go
index 27b06713a..3ab2f5676 100644
--- a/runsc/cmd/restore.go
+++ b/runsc/cmd/restore.go
@@ -33,6 +33,9 @@ type Restore struct {
// imagePath is the path to the saved container image
imagePath string
+
+ // detach indicates that runsc has to start a process and exit without waiting it.
+ detach bool
}
// Name implements subcommands.Command.Name.
@@ -55,10 +58,9 @@ func (*Restore) Usage() string {
func (r *Restore) SetFlags(f *flag.FlagSet) {
r.Create.SetFlags(f)
f.StringVar(&r.imagePath, "image-path", "", "directory path to saved container image")
+ f.BoolVar(&r.detach, "detach", false, "detach from the container's process")
// Unimplemented flags necessary for compatibility with docker.
- var d bool
- f.BoolVar(&d, "detach", false, "ignored")
var nsr bool
f.BoolVar(&nsr, "no-subreaper", false, "ignored")
@@ -92,17 +94,9 @@ func (r *Restore) Execute(_ context.Context, f *flag.FlagSet, args ...interface{
Fatalf("image-path flag must be provided")
}
- restoreFile := filepath.Join(r.imagePath, checkpointFileName)
-
- c, err := container.Load(conf.RootDir, id)
- if err != nil {
- Fatalf("loading container: %v", err)
- }
- if err := c.Restore(spec, conf, restoreFile); err != nil {
- Fatalf("restoring container: %v", err)
- }
+ conf.RestoreFile = filepath.Join(r.imagePath, checkpointFileName)
- ws, err := c.Wait()
+ ws, err := container.Run(id, spec, conf, bundleDir, r.consoleSocket, r.pidFile, r.userLog, r.detach)
if err != nil {
Fatalf("running container: %v", err)
}
diff --git a/runsc/cmd/run.go b/runsc/cmd/run.go
index 4d5f5c139..c228b4f93 100644
--- a/runsc/cmd/run.go
+++ b/runsc/cmd/run.go
@@ -29,6 +29,9 @@ import (
type Run struct {
// Run flags are a super-set of those for Create.
Create
+
+ // detach indicates that runsc has to start a process and exit without waiting it.
+ detach bool
}
// Name implements subcommands.Command.Name.
@@ -49,6 +52,7 @@ func (*Run) Usage() string {
// SetFlags implements subcommands.Command.SetFlags.
func (r *Run) SetFlags(f *flag.FlagSet) {
+ f.BoolVar(&r.detach, "detach", false, "detach from the container's process")
r.Create.SetFlags(f)
}
@@ -73,7 +77,7 @@ func (r *Run) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) s
}
specutils.LogSpec(spec)
- ws, err := container.Run(id, spec, conf, bundleDir, r.consoleSocket, r.pidFile, r.userLog)
+ ws, err := container.Run(id, spec, conf, bundleDir, r.consoleSocket, r.pidFile, r.userLog, r.detach)
if err != nil {
Fatalf("running container: %v", err)
}