summaryrefslogtreecommitdiff
path: root/pkg/specgenutil/specgen.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-18 06:08:06 -0500
committerGitHub <noreply@github.com>2022-01-18 06:08:06 -0500
commitd0eb24bae0023848447568d024acdaadb632edfe (patch)
tree43461089256941739fc91e525229e670b26697d6 /pkg/specgenutil/specgen.go
parent02502e2c14efe99b8179ca23f3341254c9f39351 (diff)
parent10d969ff1a15e8f53eb5a2fa7eb8cfb321609b55 (diff)
downloadpodman-d0eb24bae0023848447568d024acdaadb632edfe.tar.gz
podman-d0eb24bae0023848447568d024acdaadb632edfe.tar.bz2
podman-d0eb24bae0023848447568d024acdaadb632edfe.zip
Merge pull request #12870 from rhatdan/userns1
Use PODMAN_USERNS environment variable when running as a service
Diffstat (limited to 'pkg/specgenutil/specgen.go')
-rw-r--r--pkg/specgenutil/specgen.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go
index 59ac19c2c..ee089695e 100644
--- a/pkg/specgenutil/specgen.go
+++ b/pkg/specgenutil/specgen.go
@@ -206,9 +206,13 @@ func setNamespaces(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions)
return err
}
}
- // userns must be treated differently
+ userns := os.Getenv("PODMAN_USERNS")
if c.UserNS != "" {
- s.UserNS, err = specgen.ParseUserNamespace(c.UserNS)
+ userns = c.UserNS
+ }
+ // userns must be treated differently
+ if userns != "" {
+ s.UserNS, err = specgen.ParseUserNamespace(userns)
if err != nil {
return err
}