summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-02-23 15:02:21 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-01 21:17:50 +0000
commit920b66707ece354b8dbf00416b5a26abdee93a2f (patch)
tree6e2a61f6a764803e2b54550a75c54b09c1f48360
parent11091041c2e0a2333ad0401432b92709ce361eb7 (diff)
downloadpodman-920b66707ece354b8dbf00416b5a26abdee93a2f.tar.gz
podman-920b66707ece354b8dbf00416b5a26abdee93a2f.tar.bz2
podman-920b66707ece354b8dbf00416b5a26abdee93a2f.zip
Small fixes to container Exec
Fix an error message, and always set Privileged if the container is also privileged. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #412 Approved by: baude
-rw-r--r--libpod/container_api.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index eeba36a44..9011454fa 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -213,6 +213,8 @@ func (c *Container) Kill(signal uint) error {
}
// Exec starts a new process inside the container
+// TODO allow specifying streams to attach to
+// TODO investigate allowing exec without attaching
func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) error {
var capList []string
@@ -227,10 +229,11 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
conState := c.state.State
+ // TODO can probably relax this once we track exec sessions
if conState != ContainerStateRunning {
- return errors.Errorf("cannot attach to container that is not running")
+ return errors.Errorf("cannot exec into container that is not running")
}
- if privileged {
+ if privileged || c.config.Privileged {
capList = caps.GetAllCapabilities()
}
globalOpts := runcGlobalOptions{