mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Merge pull request #5916 from giuseppe/userns-auto
v2, podman: plug --userns=auto
This commit is contained in:
@ -234,6 +234,18 @@ func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []strin
|
|||||||
HostGIDMapping: true,
|
HostGIDMapping: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if mode.IsAuto() {
|
||||||
|
var err error
|
||||||
|
options.HostUIDMapping = false
|
||||||
|
options.HostGIDMapping = false
|
||||||
|
options.AutoUserNs = true
|
||||||
|
opts, err := mode.GetAutoOptions()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
options.AutoUserNsOpts = *opts
|
||||||
|
return &options, nil
|
||||||
|
}
|
||||||
if mode.IsKeepID() {
|
if mode.IsKeepID() {
|
||||||
if len(uidMapSlice) > 0 || len(gidMapSlice) > 0 {
|
if len(uidMapSlice) > 0 || len(gidMapSlice) > 0 {
|
||||||
return nil, errors.New("cannot specify custom mappings with --userns=keep-id")
|
return nil, errors.New("cannot specify custom mappings with --userns=keep-id")
|
||||||
|
Reference in New Issue
Block a user