mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Don't warn on '/' not being shared while in a container
Fixes: https://github.com/containers/podman/issues/15295 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -251,20 +251,22 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
|
||||
return false, 0, nil
|
||||
}
|
||||
|
||||
if mounts, err := pmount.GetMounts(); err == nil {
|
||||
for _, m := range mounts {
|
||||
if m.Mountpoint == "/" {
|
||||
isShared := false
|
||||
for _, o := range strings.Split(m.Optional, ",") {
|
||||
if strings.HasPrefix(o, "shared:") {
|
||||
isShared = true
|
||||
break
|
||||
if _, inContainer := os.LookupEnv("container"); !inContainer {
|
||||
if mounts, err := pmount.GetMounts(); err == nil {
|
||||
for _, m := range mounts {
|
||||
if m.Mountpoint == "/" {
|
||||
isShared := false
|
||||
for _, o := range strings.Split(m.Optional, ",") {
|
||||
if strings.HasPrefix(o, "shared:") {
|
||||
isShared = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !isShared {
|
||||
logrus.Warningf("%q is not a shared mount, this could cause issues or missing mounts with rootless containers", m.Mountpoint)
|
||||
}
|
||||
break
|
||||
}
|
||||
if !isShared {
|
||||
logrus.Warningf("%q is not a shared mount, this could cause issues or missing mounts with rootless containers", m.Mountpoint)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user