container: do not add shm in rootless mode

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
This commit is contained in:
Giuseppe Scrivano
2018-06-01 13:10:14 +02:00
committed by Atomic Bot
parent ca03627a80
commit 1e8ef3c897

View File

@ -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 == "" {