container: do not add shm in rootless mode
Closes:
Approved by: mheon
@@ -685,15 +685,15 @@ func (c *Container) mountStorage() (err error) {
return nil
}
+ if os.Getuid() == 0 {
// TODO: generalize this mount code so it will mount every mount in ctr.config.Mounts
-
mounted, err := mount.Mounted(c.config.ShmDir)
if err != nil {
return errors.Wrapf(err, "unable to determine if %q is mounted", c.config.ShmDir)
}
if err := os.Chown(c.config.ShmDir, c.RootUID(), c.RootGID()); err != nil {
- return err
+ return errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
}
if !mounted {
@@ -706,6 +706,7 @@ func (c *Container) mountStorage() (err error) {
return errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
}
}
+ }
mountPoint := c.config.Rootfs
if mountPoint == "" {
