From 5ff90677c83b78366554493e10f7615119f7e0a1 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 11 Jun 2018 16:03:34 +0200 Subject: rootless: add management for the userNS When running podman as non root user always create an userNS and let the OCI runtime use it. Signed-off-by: Giuseppe Scrivano Closes: #936 Approved by: rhatdan --- libpod/runtime.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libpod/runtime.go') diff --git a/libpod/runtime.go b/libpod/runtime.go index 21dd9d024..338a2b436 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -19,6 +19,7 @@ import ( "github.com/projectatomic/libpod/libpod/image" "github.com/projectatomic/libpod/pkg/hooks" sysreg "github.com/projectatomic/libpod/pkg/registries" + "github.com/projectatomic/libpod/pkg/rootless" "github.com/sirupsen/logrus" "github.com/ulule/deepcopier" ) @@ -197,7 +198,7 @@ func GetRootlessRuntimeDir() string { } func getDefaultTmpDir() string { - if os.Getuid() == 0 { + if !rootless.IsRootless() { return "/var/run/libpod" } @@ -216,7 +217,7 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) { configPath := ConfigPath foundConfig := true - if os.Getuid() != 0 { + if rootless.IsRootless() { foundConfig = false } else if _, err := os.Stat(OverrideConfigPath); err == nil { // Use the override configuration path -- cgit v1.2.3-54-g00ecf