mirror of
https://github.com/containers/podman.git
synced 2025-12-19 07:09:39 +08:00
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
This commit is contained in:
committed by
Atomic Bot
parent
2ed79f6315
commit
46acded58d
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user