summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/run.go24
-rw-r--r--cmd/podman/start.go4
2 files changed, 12 insertions, 16 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index 10f68e9da..0c174a729 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -108,16 +108,6 @@ func runCmd(c *cli.Context) error {
logrus.Debugf("container %q has CgroupParent %q", ctr.ID(), p)
}
- if err := ctr.Init(); err != nil {
- // This means the command did not exist
- exitCode = 127
- if strings.Index(err.Error(), "permission denied") > -1 {
- exitCode = 126
- }
- return err
- }
- logrus.Debugf("container storage created for %q", ctr.ID())
-
createConfigJSON, err := json.Marshal(createConfig)
if err != nil {
return err
@@ -135,7 +125,12 @@ func runCmd(c *cli.Context) error {
// Handle detached start
if createConfig.Detach {
if err := ctr.Start(); err != nil {
- return errors.Wrapf(err, "unable to start container %q", ctr.ID())
+ // This means the command did not exist
+ exitCode = 127
+ if strings.Index(err.Error(), "permission denied") > -1 {
+ exitCode = 126
+ }
+ return err
}
fmt.Printf("%s\n", ctr.ID())
@@ -147,7 +142,12 @@ func runCmd(c *cli.Context) error {
// Handle this when we split streams to allow attaching just stdin/out/err
attachChan, err := ctr.StartAndAttach(false, c.String("detach-keys"))
if err != nil {
- return errors.Wrapf(err, "unable to start container %q", ctr.ID())
+ // This means the command did not exist
+ exitCode = 127
+ if strings.Index(err.Error(), "permission denied") > -1 {
+ exitCode = 126
+ }
+ return err
}
if c.BoolT("sig-proxy") {
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
index 366d5c3fc..1a57a538b 100644
--- a/cmd/podman/start.go
+++ b/cmd/podman/start.go
@@ -91,10 +91,6 @@ func startCmd(c *cli.Context) error {
continue
}
- if err := ctr.Init(); err != nil && errors.Cause(err) != libpod.ErrCtrExists {
- return err
- }
-
// We can only be interactive if both the config and the command-line say so
if c.Bool("interactive") && !ctr.Config().Stdin {
return errors.Errorf("the container was not created with the interactive option")