summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-08-29 10:15:03 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-29 16:25:20 +0000
commit46acded58d71528c24f89cdef6c18a283e23cc54 (patch)
tree0224780328b5800f487d359d04e39882124e45a3 /cmd/podman
parent2ed79f6315a35a76b405f62aa85088a5b9bd9af4 (diff)
downloadpodman-46acded58d71528c24f89cdef6c18a283e23cc54.tar.gz
podman-46acded58d71528c24f89cdef6c18a283e23cc54.tar.bz2
podman-46acded58d71528c24f89cdef6c18a283e23cc54.zip
rootless, exec: use the new function to join the userns
since we have a way for joining an existing userns use it instead of nsenter. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1371 Approved by: rhatdan
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/exec.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go
index 0cd6f98b7..ed11b3c4b 100644
--- a/cmd/podman/exec.go
+++ b/cmd/podman/exec.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ "os"
"strings"
"github.com/containers/libpod/cmd/podman/libpodruntime"
@@ -84,6 +85,18 @@ func execCmd(c *cli.Context) error {
return errors.Wrapf(err, "unable to exec into %s", args[0])
}
+ pid, err := ctr.PID()
+ if err != nil {
+ return err
+ }
+ became, ret, err := rootless.JoinNS(uint(pid))
+ if err != nil {
+ return err
+ }
+ if became {
+ os.Exit(ret)
+ }
+
// ENVIRONMENT VARIABLES
env := defaultEnvVariables
for _, e := range c.StringSlice("env") {