summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/options.go24
-rw-r--r--libpod/runtime.go9
2 files changed, 24 insertions, 9 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 6783e2a39..661bd8d91 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -29,18 +29,18 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
return ErrRuntimeFinalized
}
- rt.config.StorageConfig.RunRoot = config.RunRoot
if config.RunRoot != "" {
+ rt.config.StorageConfig.RunRoot = config.RunRoot
rt.configuredFrom.storageRunRootSet = true
}
- rt.config.StorageConfig.GraphRoot = config.GraphRoot
if config.GraphRoot != "" {
+ rt.config.StorageConfig.GraphRoot = config.GraphRoot
rt.configuredFrom.storageGraphRootSet = true
}
- rt.config.StorageConfig.GraphDriverName = config.GraphDriverName
if config.GraphDriverName != "" {
+ rt.config.StorageConfig.GraphDriverName = config.GraphDriverName
rt.configuredFrom.storageGraphDriverSet = true
}
@@ -51,14 +51,20 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
rt.configuredFrom.libpodStaticDirSet = true
}
- rt.config.StorageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
- copy(rt.config.StorageConfig.GraphDriverOptions, config.GraphDriverOptions)
+ if config.GraphDriverOptions != nil {
+ rt.config.StorageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
+ copy(rt.config.StorageConfig.GraphDriverOptions, config.GraphDriverOptions)
+ }
- rt.config.StorageConfig.UIDMap = make([]idtools.IDMap, len(config.UIDMap))
- copy(rt.config.StorageConfig.UIDMap, config.UIDMap)
+ if config.UIDMap != nil {
+ rt.config.StorageConfig.UIDMap = make([]idtools.IDMap, len(config.UIDMap))
+ copy(rt.config.StorageConfig.UIDMap, config.UIDMap)
+ }
- rt.config.StorageConfig.GIDMap = make([]idtools.IDMap, len(config.GIDMap))
- copy(rt.config.StorageConfig.GIDMap, config.GIDMap)
+ if config.GIDMap != nil {
+ rt.config.StorageConfig.GIDMap = make([]idtools.IDMap, len(config.GIDMap))
+ copy(rt.config.StorageConfig.GIDMap, config.GIDMap)
+ }
return nil
}
diff --git a/libpod/runtime.go b/libpod/runtime.go
index e01fa781b..6a5d2ad39 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -278,6 +278,15 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) {
deepcopier.Copy(defaultRuntimeConfig).To(runtime.config)
runtime.config.TmpDir = tmpDir
+ if rootless.IsRootless() {
+ // If we're rootless, override the default storage config
+ storageConf, err := util.GetDefaultRootlessStoreOptions()
+ if err != nil {
+ return nil, errors.Wrapf(err, "error retrieving rootless storage config")
+ }
+ runtime.config.StorageConfig = storageConf
+ }
+
configPath := ConfigPath
foundConfig := true
rootlessConfigPath := ""