Merge pull request #42233 from AkihiroSuda/fix-rootless-bind-EPERM-20.10

[20.10 backport] rootless: bind mount: fix "operation not permitted"
This commit is contained in:
Tibor Vass 2021-04-01 07:41:54 -07:00 committed by GitHub
commit 88bd96d6e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -648,7 +648,7 @@ func WithMounts(daemon *Daemon, c *container.Container) coci.SpecOpts {
// "mount" when we bind-mount. The reason for this is that at the point
// when runc sets up the root filesystem, it is already inside a user
// namespace, and thus cannot change any flags that are locked.
if daemon.configStore.RemappedRoot != "" {
if daemon.configStore.RemappedRoot != "" || sys.RunningInUserNS() {
unprivOpts, err := getUnprivilegedMountFlags(m.Source)
if err != nil {
return err