2021-08-23 13:14:53 +00:00
|
|
|
//go:build !windows
|
2015-07-16 21:14:58 +00:00
|
|
|
// +build !windows
|
|
|
|
|
2018-02-05 21:05:59 +00:00
|
|
|
package daemon // import "github.com/docker/docker/daemon"
|
2015-07-16 21:14:58 +00:00
|
|
|
|
2016-01-20 23:32:02 +00:00
|
|
|
import (
|
2016-04-27 02:26:12 +00:00
|
|
|
"github.com/docker/docker/container"
|
2018-04-17 20:50:28 +00:00
|
|
|
volumemounts "github.com/docker/docker/volume/mounts"
|
2016-01-20 23:32:02 +00:00
|
|
|
)
|
2015-11-12 19:55:17 +00:00
|
|
|
|
2015-07-16 21:14:58 +00:00
|
|
|
// checkIfPathIsInAVolume checks if the path is in a volume. If it is, it
|
|
|
|
// cannot be in a read-only volume. If it is not in a volume, the container
|
|
|
|
// cannot be configured with a read-only rootfs.
|
2015-11-12 19:55:17 +00:00
|
|
|
func checkIfPathIsInAVolume(container *container.Container, absPath string) (bool, error) {
|
2015-07-16 21:14:58 +00:00
|
|
|
var toVolume bool
|
2021-06-11 19:01:18 +00:00
|
|
|
parser := volumemounts.NewParser()
|
2015-07-16 21:14:58 +00:00
|
|
|
for _, mnt := range container.MountPoints {
|
2017-08-01 17:32:44 +00:00
|
|
|
if toVolume = parser.HasResource(mnt, absPath); toVolume {
|
2015-07-16 21:14:58 +00:00
|
|
|
if mnt.RW {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
return false, ErrVolumeReadonly
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return toVolume, nil
|
|
|
|
}
|
2016-01-20 23:32:02 +00:00
|
|
|
|
2017-03-15 18:29:12 +00:00
|
|
|
// isOnlineFSOperationPermitted returns an error if an online filesystem operation
|
|
|
|
// is not permitted.
|
|
|
|
func (daemon *Daemon) isOnlineFSOperationPermitted(container *container.Container) error {
|
|
|
|
return nil
|
|
|
|
}
|