summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-07-24 17:12:33 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-24 21:50:49 +0000
commit819c80712578cce1d5fd1915a351bc739c7fcb72 (patch)
treec988a6f0ec51c4b5c5f885dbc7f9a321de8d75f6 /pkg/spec
parent41c7e43b4dbba117d41d82cd8d5c0f004daba21e (diff)
downloadpodman-819c80712578cce1d5fd1915a351bc739c7fcb72.tar.gz
podman-819c80712578cce1d5fd1915a351bc739c7fcb72.tar.bz2
podman-819c80712578cce1d5fd1915a351bc739c7fcb72.zip
podman: allow to specify the userns to join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1145 Approved by: rhatdan
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/spec.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go
index acc41f7c5..dcf1c51dd 100644
--- a/pkg/spec/spec.go
+++ b/pkg/spec/spec.go
@@ -326,6 +326,14 @@ func addPidNS(config *CreateConfig, g *generate.Generator) error {
}
func addUserNS(config *CreateConfig, g *generate.Generator) error {
+ if IsNS(string(config.UsernsMode)) {
+ g.AddOrReplaceLinuxNamespace(spec.UserNamespace, NS(string(config.UsernsMode)))
+
+ // runc complains if no mapping is specified, even if we join another ns. So provide a dummy mapping
+ g.AddLinuxUIDMapping(uint32(0), uint32(0), uint32(1))
+ g.AddLinuxGIDMapping(uint32(0), uint32(0), uint32(1))
+ }
+
if (len(config.IDMappings.UIDMap) > 0 || len(config.IDMappings.GIDMap) > 0) && !config.UsernsMode.IsHost() {
g.AddOrReplaceLinuxNamespace(spec.UserNamespace, "")
}