File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -622,7 +622,19 @@ func mountToRootfs(c *mountConfig, m mountEntry) error {
622622 // "proc" and "sys" mounts need special handling (without resolving the
623623 // destination) to avoid attacks.
624624 m .dstFile = dstFile
625- return m .mountPropagate (rootfs , "" )
625+ err = m .mountPropagate (rootfs , "" )
626+ if err != nil && m .Device == "sysfs" && errors .Is (err , unix .EPERM ) {
627+ logrus .Debugf ("cannot mount sysfs with properties, fallback to bind mount: %v" , err )
628+ bindM := & configs.Mount {
629+ Device : "bind" ,
630+ Source : "/sys" ,
631+ Destination : m .Destination ,
632+ Flags : unix .MS_BIND | unix .MS_REC | m .Flags ,
633+ PropagationFlags : m .PropagationFlags ,
634+ }
635+ return mountToRootfs (c , mountEntry {Mount : bindM })
636+ }
637+ return err
626638 }
627639
628640 mountLabel := c .label
You can’t perform that action at this time.
0 commit comments