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