diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-08-15 10:26:26 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-08-15 10:28:29 -0400 |
commit | ab72a371bb8a8e246592614a2d5874158e27c3de (patch) | |
tree | 3a16e2845b097d105c4fb0c88ab480e45cced766 /pkg/rootless | |
parent | 66f29995b980b2f1dafbf160888a4db8d4ce2aa4 (diff) | |
download | podman-ab72a371bb8a8e246592614a2d5874158e27c3de.tar.gz podman-ab72a371bb8a8e246592614a2d5874158e27c3de.tar.bz2 podman-ab72a371bb8a8e246592614a2d5874158e27c3de.zip |
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>
Diffstat (limited to 'pkg/rootless')
-rw-r--r-- | pkg/rootless/rootless_linux.go | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go index b0012b32b..8c4316dbb 100644 --- a/pkg/rootless/rootless_linux.go +++ b/pkg/rootless/rootless_linux.go @@ -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 } } } |