userns: add new option --userns=keep-id

it creates a namespace where the current UID:GID on the host is mapped
to the same UID:GID in the container.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2019-05-23 22:28:59 +02:00
parent 6df320c391
commit f09370c68b
7 changed files with 79 additions and 5 deletions

View File

@ -3,6 +3,7 @@
package integration
import (
"fmt"
"os"
. "github.com/containers/libpod/test/utils"
@ -76,4 +77,12 @@ var _ = Describe("Podman UserNS support", func() {
Expect(ok).To(BeTrue())
})
It("podman --userns=keep-id", func() {
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "id", "-u"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
uid := fmt.Sprintf("%d", os.Geteuid())
ok, _ := session.GrepString(uid)
Expect(ok).To(BeTrue())
})
})