aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-04-17 15:56:46 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-18 14:44:51 +0000
commit95f272a0c55d2e33de1f69ce3c7f029c2c3c2c0d (patch)
tree2fa9b9c7333621cb4f3ebd20b5056522990aea29 /cmd/podman
parent313e5e83e92f68349d2026fc3f358f237fe93a4a (diff)
downloadpodman-95f272a0c55d2e33de1f69ce3c7f029c2c3c2c0d.tar.gz
podman-95f272a0c55d2e33de1f69ce3c7f029c2c3c2c0d.tar.bz2
podman-95f272a0c55d2e33de1f69ce3c7f029c2c3c2c0d.zip
Allow podman start to attach to a running container
If a container is already running, and a user asks to start it -a (attach), we should honor this and attach to the container. Signed-off-by: baude <bbaude@redhat.com> Closes: #634 Approved by: baude
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/start.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
index 00d153904..8f6fc5800 100644
--- a/cmd/podman/start.go
+++ b/cmd/podman/start.go
@@ -96,6 +96,14 @@ func startCmd(c *cli.Context) error {
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"))
+ }
+
if err := startAttachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.String("detach-keys"), c.Bool("sig-proxy")); err != nil {
return errors.Wrapf(err, "unable to start container %s", ctr.ID())
}