|
@@ -1224,21 +1224,21 @@ func setupDaemonRoot(config *config.Config, rootDir string, remappedRoot idtools
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ id := idtools.Identity{UID: idtools.CurrentIdentity().UID, GID: remappedRoot.GID}
|
|
|
|
+ // First make sure the current root dir has the correct perms.
|
|
|
|
+ if err := idtools.MkdirAllAndChown(config.Root, 0710, id); err != nil {
|
|
|
|
+ return errors.Wrapf(err, "could not create or set daemon root permissions: %s", config.Root)
|
|
|
|
+ }
|
|
|
|
+
|
|
// if user namespaces are enabled we will create a subtree underneath the specified root
|
|
// if user namespaces are enabled we will create a subtree underneath the specified root
|
|
// with any/all specified remapped root uid/gid options on the daemon creating
|
|
// with any/all specified remapped root uid/gid options on the daemon creating
|
|
// a new subdirectory with ownership set to the remapped uid/gid (so as to allow
|
|
// a new subdirectory with ownership set to the remapped uid/gid (so as to allow
|
|
// `chdir()` to work for containers namespaced to that uid/gid)
|
|
// `chdir()` to work for containers namespaced to that uid/gid)
|
|
if config.RemappedRoot != "" {
|
|
if config.RemappedRoot != "" {
|
|
- id := idtools.CurrentIdentity()
|
|
|
|
- // First make sure the current root dir has the correct perms.
|
|
|
|
- if err := idtools.MkdirAllAndChown(config.Root, 0701, id); err != nil {
|
|
|
|
- return errors.Wrapf(err, "could not create or set daemon root permissions: %s", config.Root)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
config.Root = filepath.Join(rootDir, fmt.Sprintf("%d.%d", remappedRoot.UID, remappedRoot.GID))
|
|
config.Root = filepath.Join(rootDir, fmt.Sprintf("%d.%d", remappedRoot.UID, remappedRoot.GID))
|
|
logrus.Debugf("Creating user namespaced daemon root: %s", config.Root)
|
|
logrus.Debugf("Creating user namespaced daemon root: %s", config.Root)
|
|
// Create the root directory if it doesn't exist
|
|
// Create the root directory if it doesn't exist
|
|
- if err := idtools.MkdirAllAndChown(config.Root, 0701, id); err != nil {
|
|
|
|
|
|
+ if err := idtools.MkdirAllAndChown(config.Root, 0710, id); err != nil {
|
|
return fmt.Errorf("Cannot create daemon root: %s: %v", config.Root, err)
|
|
return fmt.Errorf("Cannot create daemon root: %s: %v", config.Root, err)
|
|
}
|
|
}
|
|
// we also need to verify that any pre-existing directories in the path to
|
|
// we also need to verify that any pre-existing directories in the path to
|