2015-07-16 17:14:58 -04:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package daemon
|
|
|
|
|
2015-11-12 14:55:17 -05:00
|
|
|
import "github.com/docker/docker/container"
|
|
|
|
|
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
|
|
|
|
for _, mnt := range container.MountPoints {
|
2015-09-09 22:23:06 -04:00
|
|
|
if toVolume = mnt.HasResource(absPath); toVolume {
|
2015-07-16 17:14:58 -04:00
|
|
|
if mnt.RW {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
return false, ErrVolumeReadonly
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return toVolume, nil
|
|
|
|
}
|