2015-07-16 17:14:58 -04:00
|
|
|
// +build !windows
|
|
|
|
|
2018-02-05 16:05:59 -05:00
|
|
|
package daemon // import "github.com/docker/docker/daemon"
|
2015-07-16 17:14:58 -04:00
|
|
|
|
2016-01-20 18:32:02 -05:00
|
|
|
import (
|
2016-04-26 22:26:12 -04:00
|
|
|
"github.com/docker/docker/container"
|
2018-04-17 16:50:28 -04:00
|
|
|
volumemounts "github.com/docker/docker/volume/mounts"
|
2016-01-20 18:32:02 -05:00
|
|
|
)
|
2015-11-12 14:55:17 -05:00
|
|
|
|
2015-07-16 17:14:58 -04: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 14:55:17 -05:00
|
|
|
func checkIfPathIsInAVolume(container *container.Container, absPath string) (bool, error) {
|
2015-07-16 17:14:58 -04:00
|
|
|
var toVolume bool
|
2018-04-17 16:50:28 -04:00
|
|
|
parser := volumemounts.NewParser(container.OS)
|
2015-07-16 17:14:58 -04:00
|
|
|
for _, mnt := range container.MountPoints {
|
2017-08-01 13:32:44 -04:00
|
|
|
if toVolume = parser.HasResource(mnt, absPath); toVolume {
|
2015-07-16 17:14:58 -04:00
|
|
|
if mnt.RW {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
return false, ErrVolumeReadonly
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return toVolume, nil
|
|
|
|
}
|
2016-01-20 18:32:02 -05:00
|
|
|
|
2017-03-15 14:29:12 -04:00
|
|
|
// isOnlineFSOperationPermitted returns an error if an online filesystem operation
|
|
|
|
// is not permitted.
|
|
|
|
func (daemon *Daemon) isOnlineFSOperationPermitted(container *container.Container) error {
|
|
|
|
return nil
|
|
|
|
}
|