mirror of
https://github.com/containers/podman.git
synced 2025-06-24 11:28:24 +08:00
Merge pull request #1777 from rhatdan/shm
/dev/shm should be mounted even in rootless mode.
This commit is contained in:
@ -821,28 +821,22 @@ func (c *Container) mountStorage() (string, error) {
|
|||||||
return c.state.Mountpoint, nil
|
return c.state.Mountpoint, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !rootless.IsRootless() {
|
mounted, err := mount.Mounted(c.config.ShmDir)
|
||||||
// TODO: generalize this mount code so it will mount every mount in ctr.config.Mounts
|
if err != nil {
|
||||||
mounted, err := mount.Mounted(c.config.ShmDir)
|
return "", errors.Wrapf(err, "unable to determine if %q is mounted", c.config.ShmDir)
|
||||||
if err != nil {
|
}
|
||||||
return "", errors.Wrapf(err, "unable to determine if %q is mounted", c.config.ShmDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if !mounted {
|
||||||
|
shmOptions := fmt.Sprintf("mode=1777,size=%d", c.config.ShmSize)
|
||||||
|
if err := c.mountSHM(shmOptions); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
if err := os.Chown(c.config.ShmDir, c.RootUID(), c.RootGID()); err != nil {
|
if err := os.Chown(c.config.ShmDir, c.RootUID(), c.RootGID()); err != nil {
|
||||||
return "", errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
|
return "", errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !mounted {
|
|
||||||
shmOptions := fmt.Sprintf("mode=1777,size=%d", c.config.ShmSize)
|
|
||||||
if err := c.mountSHM(shmOptions); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if err := os.Chown(c.config.ShmDir, c.RootUID(), c.RootGID()); err != nil {
|
|
||||||
return "", errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: generalize this mount code so it will mount every mount in ctr.config.Mounts
|
||||||
mountPoint := c.config.Rootfs
|
mountPoint := c.config.Rootfs
|
||||||
if mountPoint == "" {
|
if mountPoint == "" {
|
||||||
mountPoint, err = c.mount()
|
mountPoint, err = c.mount()
|
||||||
|
Reference in New Issue
Block a user