diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/util/utils.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go index 56a57c15a..28dd015bd 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -2,6 +2,7 @@ package util import ( "fmt" + "os" "strconv" "strings" @@ -142,6 +143,12 @@ func ParseIDMapping(UIDMapSlice, GIDMapSlice []string, subUIDMap, subGIDMap stri if len(UIDMapSlice) == 0 && len(GIDMapSlice) != 0 { UIDMapSlice = GIDMapSlice } + if len(UIDMapSlice) == 0 && subUIDMap == "" && os.Getuid() != 0 { + UIDMapSlice = []string{fmt.Sprintf("0:%d:1", os.Getuid())} + } + if len(GIDMapSlice) == 0 && subGIDMap == "" && os.Getuid() != 0 { + GIDMapSlice = []string{fmt.Sprintf("0:%d:1", os.Getgid())} + } parseTriple := func(spec []string) (container, host, size int, err error) { cid, err := strconv.ParseUint(spec[0], 10, 32) |