mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
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:
@ -12,6 +12,11 @@ func (n UsernsMode) IsHost() bool {
|
||||
return n == "host"
|
||||
}
|
||||
|
||||
// IsKeepID indicates whether container uses a mapping where the (uid, gid) on the host is lept inside of the namespace.
|
||||
func (n UsernsMode) IsKeepID() bool {
|
||||
return n == "keep-id"
|
||||
}
|
||||
|
||||
// IsPrivate indicates whether the container uses the a private userns.
|
||||
func (n UsernsMode) IsPrivate() bool {
|
||||
return !(n.IsHost())
|
||||
@ -21,7 +26,7 @@ func (n UsernsMode) IsPrivate() bool {
|
||||
func (n UsernsMode) Valid() bool {
|
||||
parts := strings.Split(string(n), ":")
|
||||
switch mode := parts[0]; mode {
|
||||
case "", "host":
|
||||
case "", "host", "keep-id":
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user