summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-15 18:31:07 +0000
committerGitHub <noreply@github.com>2022-08-15 18:31:07 +0000
commitc649490d3fa6714409cb9e2caf15ca176a1e1516 (patch)
tree70f86125da313488fc3e0b6a1f33883f167b2990
parentfe54d404ffbb0b94d48f8a521016a75491652a91 (diff)
parentab72a371bb8a8e246592614a2d5874158e27c3de (diff)
downloadpodman-c649490d3fa6714409cb9e2caf15ca176a1e1516.tar.gz
podman-c649490d3fa6714409cb9e2caf15ca176a1e1516.tar.bz2
podman-c649490d3fa6714409cb9e2caf15ca176a1e1516.zip
Merge pull request #15323 from rhatdan/warn
Don't warn on '/' not being shared while in a container
-rw-r--r--pkg/rootless/rootless_linux.go26
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
}
}
}