diff options
Diffstat (limited to 'cmd/podman/run.go')
-rw-r--r-- | cmd/podman/run.go | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go index 45a428f39..eecfe87b3 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -29,13 +29,24 @@ func runCmd(c *cli.Context) error { if err := validateFlags(c, createFlags); err != nil { return err } + + if c.String("cidfile") != "" { + if err := libpod.WriteFile("", c.String("cidfile")); err != nil { + return errors.Wrapf(err, "unable to write cidfile %s", c.String("cidfile")) + } + } + runtime, err := getRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } defer runtime.Shutdown(false) + if len(c.Args()) < 1 { + return errors.Errorf("image name or ID is required") + } - createConfig, err := parseCreateOpts(c, runtime) + imageName, _, data, err := imageData(c, runtime, c.Args()[0]) + createConfig, err := parseCreateOpts(c, runtime, imageName, data) if err != nil { return err } @@ -56,6 +67,7 @@ func runCmd(c *cli.Context) error { options = append(options, libpod.WithLabels(createConfig.Labels)) options = append(options, libpod.WithUser(createConfig.User)) options = append(options, libpod.WithShmDir(createConfig.ShmDir)) + options = append(options, libpod.WithShmSize(createConfig.Resources.ShmSize)) ctr, err := runtime.NewContainer(runtimeSpec, options...) if err != nil { return err @@ -83,8 +95,9 @@ func runCmd(c *cli.Context) error { logrus.Debug("new container created ", ctr.ID()) if c.String("cidfile") != "" { - libpod.WriteFile(ctr.ID(), c.String("cidfile")) - return nil + if err := libpod.WriteFile(ctr.ID(), c.String("cidfile")); err != nil { + logrus.Error(err) + } } // Create a bool channel to track that the console socket attach |