summaryrefslogtreecommitdiff
path: root/cmd/podman/common/specgen.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-24 22:39:26 +0200
committerGitHub <noreply@github.com>2020-04-24 22:39:26 +0200
commit2afe579c064923841a55d57458fac4d91bec8173 (patch)
tree698f40ce419698c30cf8969b9438b3aa395f8434 /cmd/podman/common/specgen.go
parent10f3a8ac6bd9028f1c70ad48a7ebf2b2e33f2d6e (diff)
parent88f1994ab9a0bf3a8df3c8f74a39cd1db27c2070 (diff)
downloadpodman-2afe579c064923841a55d57458fac4d91bec8173.tar.gz
podman-2afe579c064923841a55d57458fac4d91bec8173.tar.bz2
podman-2afe579c064923841a55d57458fac4d91bec8173.zip
Merge pull request #5971 from giuseppe/fix-userns-tests
v2, podman: fix and enable all run_userns_test.go tests
Diffstat (limited to 'cmd/podman/common/specgen.go')
-rw-r--r--cmd/podman/common/specgen.go21
1 files changed, 6 insertions, 15 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index abec1213c..488843f41 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -209,10 +209,15 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
}
}
- s.IDMappings, err = util.ParseIDMapping(ns.UsernsMode(c.UserNS), c.UIDMap, c.GIDMap, c.SubUIDName, c.SubGIDName)
+ userNS := ns.UsernsMode(c.UserNS)
+ s.IDMappings, err = util.ParseIDMapping(userNS, c.UIDMap, c.GIDMap, c.SubUIDName, c.SubGIDName)
if err != nil {
return err
}
+ // If some mappings are specified, assume a private user namespace
+ if userNS.IsDefaultValue() && (!s.IDMappings.HostUIDMapping || !s.IDMappings.HostGIDMapping) {
+ s.UserNS.NSMode = specgen.Private
+ }
s.Terminal = c.TTY
ep, err := ExposedPorts(c.Expose, c.Net.PublishPorts, c.PublishAll, nil)
@@ -246,20 +251,6 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
s.NetNS = c.Net.Network
}
- // TODO this is going to have to be done the libpod/server end of things
- // USER
- //user := c.String("user")
- //if user == "" {
- // switch {
- // case usernsMode.IsKeepID():
- // user = fmt.Sprintf("%d:%d", rootless.GetRootlessUID(), rootless.GetRootlessGID())
- // case data == nil:
- // user = "0"
- // default:
- // user = data.Config.User
- // }
- //}
-
// STOP SIGNAL
signalString := "TERM"
if sig := c.StopSignal; len(sig) > 0 {