From cc7d1de1c11e1846552c0f81811a1fbab3711151 Mon Sep 17 00:00:00 2001 From: baude Date: Wed, 18 Apr 2018 13:12:38 -0500 Subject: It is OK to start an already running container (with no attach) Signed-off-by: baude Closes: #637 Approved by: rhatdan --- cmd/podman/start.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/podman/start.go b/cmd/podman/start.go index 8f6fc5800..06b8f815f 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -90,16 +90,16 @@ func startCmd(c *cli.Context) error { continue } + ctrState, err := ctr.State() + if err != nil { + return errors.Wrapf(err, "unable to get container state") + } + if attach { inputStream := os.Stdin if !c.Bool("interactive") { inputStream = nil } - - ctrState, err := ctr.State() - if err != nil { - return errors.Wrapf(err, "unable to get container state") - } if ctrState == libpod.ContainerStateRunning { return attachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.String("detach-keys"), c.BoolT("sig-proxy")) } @@ -116,7 +116,10 @@ func startCmd(c *cli.Context) error { return ctr.Cleanup() } - + if ctrState == libpod.ContainerStateRunning { + fmt.Println(ctr.ID()) + continue + } // Handle non-attach start if err := ctr.Start(); err != nil { if lastError != nil { -- cgit v1.2.3-54-g00ecf